XlocaleData (an excerpt from the Developers Guide I18n chapter)[TOPIC:com.sun.star.i18n.XLocaleData]One of the most important tasks in implementing a new locale is to define all the locale data to be used, listed in the following table as types returned by the [IDL:com.sun.star.i18n.XLocaleData] interface methods:
Locale data is defined in an XML file. It is translated into a C++ source file during the build process, which is compiled and linked together with other compiled locale data files into shared libraries. The contents of the XML file, their elements, and how they are to be defined are described in i18npool/source/localedata/data/locale.dtd. The latest revision available for a specific CVS branch of that file provides up-to-date information about the definitions, as well as additional information. If the language-country combination is not already listed in tools/inc/lang.hxx and tools/source/intntl/isolang.cxx and svx/source/dialog/langtab.src, OpenOffice.org is probably not prepared to deal with your specific locale. For assistance, you can consult http://l10n.openoffice.org/adding_language.html#step1 (Add the New Language to the Resource System) and join the dev@l10n.openoffice.org mailing list (see also http://l10n.openoffice.org/servlets/ProjectMailingListList). In order to conform with the available build infrastructure, the name of your locale data file should follow the conventions used in the i18npool/source/localedata/data directory: <language>_<country>.xml, where language is a lowercase, two letter ISO-639 code, and country is an uppercase two letter ISO-3166 code. Start by copying the en_US.xml file to your <language>_<country>.xml file and adopt the entries to suit your needs. Add the corresponding *.cxx and *.obj target file name to the i18npool/source/localedata/data/makefile.mk. Note that there is an explicit rule defined, so that you do not need to add the *.xml file name anywhere. You must also add the locale to the aDllsTable structure located in i18npool/source/localedata/data/localedata.cxx. Make sure to specify the correct library name, since it must correspond to the library name used in the makefile. Finally, the public symbols to be exported must be added to the linker map file corresponding to the library. You can use the i18npool/source/localedata/data/linkermapfile-check.awk script to assist you. Instructions for how to use the script are located the header comments of the file. <LC_FORMAT><FormatElement> To be able to load documents of
versions up to and including StarOffice 5.2 (old binary file format),
each locale must define all number formats mentioned in
[IDL:com.sun.star.i18n.NumberFormatIndex]
and assign the proper formatindex="..."
attribute. <LC_FORMAT><FormatElement><FormatCode> In general, definition of number
format codes follows the user visible rules, apart from that any
non-ASCII character must be entered using UTF-8 encoding. For a
detailed description of codes and a list of possible keywords please
consult the OpenOffice.org English online help on section "number
format codes". <FormatCode usage="DATE"> and <FormatCode usage="DATE_TIME"> Characters of date and time
keywords, such as YYYY for year, had previously been localized for a
few locales (for example, JJJJ in German). The new I18N framework no
longer follows that approach, because it may lead to ambiguous and
case insensitive character combinations that cannot be resolved at
runtime. Localized keyword support is only given for some old
locales, other locales must define their codes using English
notation.
<FormatCode
usage="DATE" formatindex="21"> and
The formatindex="21"
[IDL:com.sun.star.i18n.NumberFormatIndex] DATE_SYS_DDMMYYYY
format code is used to edit date formatted data. It represents a date
using the most detailed information available, for example, a 4-digit
year and instead of a 2-digit year. The YMD default order (how a date
is assembled) is determined from the order encountered in this
format. <FormatCode usage="CURRENCY"> The [$xxx-yyy] notation is needed for compatibility reasons. The xxx part denotes the currency symbol, and the yyy part specifies the locale identifier in Microsoft Language ID hexadecimal notation. For example, having “409” as the locale identifier (English-US) and “$” as the currency symbol results in [$$-409]. A list of available Language IDs known to the OpenOffice.org application can be found at project util module tools in file tools/inc/lang.hxx. Format indices 12, 13, 14, 15, 17 with [$xxx-yyy] notation must use the xxx currency symbol that has the attribute usedInCompatibleFormatCodes="true" (see element <LC_CURRENCY> in the locale.dtd file). |

