Skip to content

start:

Adding a New Language to the Office Suite

Note: These instructions are for OOo 1.x only! Most of this document changed for OOo 2.0. See also Support of ISO-codes and merge-while-build in the build environment. For up-to-date information please see the l10n main page. Links pointing to this page's URI should be updated to reflect the situation, please inform the webmaster / site maintainer of the page that lead you here, thank you.

This document describes how to add a new language to the OpenOffice.org office suite.

To add a new language to the office suite, follow these steps:

For information on the naming convention for resource files, see the following topic:

Step 1: Add the New Language to the Resource System

To add a new language to the resource system, do the following:

  1. Add the new language to the header file tools/inc/lang.hxx.
    This is already done for most languages.
    Only if there is no reserved LANGID defined by Microsoft, define a LANGUAGE_USER_... value conforming to MS-LANGID rules of the user space. Be sure it doesn't conflict with already existing entries or primary languages or their combinations with sublanguages. For technical information about MS-LANGID values please see the latest revision of the lang.hxx file. If in doubt please contact the dev@l10n.openoffice.org mailing list before messing around with that file.

  2. In the C++ file tools/source/intntl/isolang.cxx create a unique back and forth mapping between the LANGID and it's ISO names.
    Without this, the corresponding locale will not be offered at various places. Mere UI localization might work without, using the locale as document attribution will not.

  3. For the locale to be correctly shown in listboxes, add an UI visible entry to the string list arrays of available locales in the resource file svx/source/dialog/langtab.src. This is subject to localization, currently at least English_US and German entries have to be provided in order to trigger automatic extraction for localization tools.

  4. Add the new language to the method ResMgr::GetLang(...) and ResMgr::SearchCreateResMgr(...) in the C++ file tools/source/rc/resmgr.cxx.
    This is already done for most languages.

  5. Add the language to rsc/inc/rsclang.c to support the new language by the resource compiler.

  6. To be able to select the language from the listboxes in the font dialog's character attribution, (b) and (c) MUST have proper definitions. In addition, to be able to select the language as the default document language in the configuration, or to have it available in number formats, and for providing other locale dependent information, you need to add locale data as described in http://l10n.openoffice.org/i18n_framework/LocaleData.html.
    Adding locale data is not necessary for mere UI translation.

Step 2: Add the New Language to the Build Environment

To add a new language to the build environment, do the following:

  1. Add the new language to the makefile solenv/inc/lang.mk and solenv/inc/postset.mk.

  2. Add the encoding of the strings and messages in the source code for the new language to the makefile solenv/inc/lang.mk and solenv/inc/postset.mk.

Step 3: Add the New Language to the Localization Tools

To add a new language to the localization tools, do the following:

  1. Add new language define directives to the header file transex3/inc/export.hxx.

  2. Add the new language to the macro LANGUAGE_ALLOWED in the header file transex3/inc/export.hxx.

  3. Add a symbolic representation for the new language to the array Export::LangName in the C++ file transex3/source/export2.cxx.
    This symbolic representation must be unique. It is used in the source code of resource files. The symbolic representation must be the same as in the corresponding .src file. The order of the symbolic representations must be the same as the order of the define directives in transex3/inc/export.hxx.

  4. Add the new language to the array Export::LangId in the C++ file transex3/source/export2.cxx.

  5. Add the encoding of the strings and messages in source code for this language to the method Langcode2TextEncoding(..) in the file tools/source/generic/l2txtenc.cxx.

  6. Add the new language to the method MergeDataFile::GetLangIndex(...) in the C++ file transex3/source/merge.cxx.

Step 4: Extract Strings and Messages from the Source Code

Extract all strings and messages from the source code. For more information on how to do this, see Extracting and Merging Strings and Messages.

Step 5: Translate Extracted Strings and Messages to the New Language

When translating the text, use the correct encoding used in step 2 and step 3 to store the translated strings. Also, store all other information that is generated when extracting the strings and messages. The information is mandatory for merging back translated text.

Step 6: Merge Translated Strings and Messages to Source Code

To merge translated strings and messages back to the source code, do the following:

  1. Store the translated text in input file format for merging. For more information on the input file format, see Extracting and Merging Strings and Messages.

  2. Merge the translated text into the source code by running the localization tools with the merge option.

Step 7: Add new language to the installation set project

To be able to create an installation set in the new language, some changes in the scp project have to be done. In the scp project the script files setup.ins (setup.inf for Windows) are created which are used in the packaging process of the installation set and in the installation process of OpenOffice.org itself. For infos about the scp project, see The scp-project in OpenOffice.org.

  1. Add the new language to all language dependent macros in the global definition file scp/inc/gcfg.inc

  2. Add the new language to all setup basic scripts, which show a MessageBox (SiMsgBox) in the files scp/source/office/basic.scp and scp/source/office/unxbasic.scp

  3. Add the new language to the ConfigurationItems in the scp/source/office/profile.scp, where CJK features are set. Search for the string ''_CJK_'' and decide, whether the new language needs the CJK support or not.

  4. Finally in the file scp/source/office/files.scp you can search for the string ''samchapters'' and decide, whether the zip file ''samchaptersXY.zip'' (XY is the language ID) exists for the new language or not.

Step 8: Adding new language to the module “helpcontent” and “readlicense_oo”

For localization of OpenOffice.org Online Help use it's own localization framework. Beside translation, the module “readlicense_oo” needs adding your language to “readlicense_oo/prj/d.lst” to make it available to the installation set.

Naming Convention for Resource Files

Strings and messages are compiled into special resource files, which are named as follows:

xxxUPDnn.res

The naming convention is as follows:

xxx

The name of the binary that the strings and messages in the resource file belong to.

UPD

The number of the release in which the resource file was compiled.

nn

A two number code that signifies the language of the strings and messages. This number is often the international telephone code for the country that the language is spoken in. For example, 49 represents German.

For example, the meaning of the filename sfx59949.res is as follows:

sfx

StarFrame Works. The functionality of this resource is in the sfx59949 library.

599

This resource was compiled with release number 599 of the build environment.

49

The language code for German.

In summary, sfx59949.res contains all the German strings and messages that the sfx59949 library uses.

Note: These naming conventions apply only to the OpenOffice.org resource system. The strings and messages used in the OpenOffice.org resource system are declared in files with the extensions .src and .hrc.