12 April 2014: The OpenOffice Wiki is not, and never was, affected by the heartbleed bug. Users' passwords are safe and wiki users do not need take any actions.

Technical Background

From Apache OpenOffice Wiki
Jump to: navigation, search



This section provides an overview of how the Dialog Localization feature works internally and how the resources are stored. In case of a localized Dialog Library the localized properties do not contain strings but Resource IDs referring to a String Resource table. Example:

Dialog XML snippet, not localized:

 <dlg:window ... dlg:title="My Dialog">
 ...
 <dlg:button ... dlg:value="My Label"/>

Dialog XML snippet, localized:

 <dlg:window ... dlg:title="&1.Dialog1.Title">
 ...
 <dlg:button ... dlg:value="&3.Dialog1.CommandButton1.Label"/>

"&" is the XML encoding for the & character. This character is used as escape character marking the string as localized. The pure Resource ID is 1.Dialog1.Title respectively 3.Dialog1.CommandButton1.Label.

The strings referenced by the Resource IDs are stored in files meeting the format of Java properties files, e.g. described in http://java.sun.com/j2se/1.4.2/docs/api/java/util/Properties.html. In the Library's folder one of these files is stored for each language following a special naming scheme. For the languages used in the example above the following files are stored in the Dialog Library's folder (both for Application based libraries stored in the file system and for Document based libraries stored in a document's package file):

 Dialog1.xdl                     // Dialog XML description
 DialogStrings_en_US.properties  // English (USA) properties file
 DialogStrings_et_EE.properties  // Estonian properties file
 DialogStrings_fr_FR.properties  // French properties file
 DialogStrings_en_US.default     // Empty file marking English (USA) as default language

Each of these files contain all strings for the corresponding language using the Resource IDs as keys. The French properties file for the dialog shown in the last illustration looks like this:

 # Strings for Dialog Library Standard
 0.Dialog1.HelpText=1.Dialog
 1.Title=French Dialog
 2.Dialog1.CommandButton1.HelpText=
 3.Dialog1.CommandButton1.Label=French
 4.Dialog1.CheckBox1.HelpText=
 5.Dialog1.CheckBox1.Label=French Box1
 6.Dialog1.CheckBox2.HelpText=
 7.Dialog1.CheckBox2.Label=French Box2
 8.Dialog1.ListBox1.HelpText=
 9.ListBox1.StringItemList=French List Entry1
 10.ListBox1.StringItemList=French List Entry2
 11.ListBox1.StringItemList=French List Entry3

The IDs start with a numeric part that is unique for the complete library. The textual part following then contains the Dialog, Control and Property name the Resource ID refers to. The numeric ID alone would be unique but the textual part makes it easier to associate Resource IDs and controls when resource properties files should be edited manually. When the dialog or controls are renamed the Resource IDs are renamed accordingly.

The UNO API used for managing the String Resource is placed in com.sun.star.resource. Each Dialog Library supports com.sun.star.resource.XStringResourceSupplier, giving access to a com.sun.star.resource.StringResource component. This component supports com.sun.star.resource.XStringResourceResolver, allowing to resolve strings using Resource IDs as keys and com.sun.star.resource.XStringResourceManager, allowing to add and remove strings and languages.

In case of an Application Dialog Library the StringResource supports com.sun.star.resource.StringResourceWithLocation allowing to read/write the properties files from/to the file system. In case of a Document Dialog Library the StringResource supports com.sun.star.resource.StringResourceWithStorage allowing to read/write the properties files from/to the document's package file.

Further details are described in the IDL documentation.

Content on this page is licensed under the Public Documentation License (PDL).
Personal tools
In other languages