LibreOffice Localization Guide/Adding a New Language or Locale

From The Document Foundation Wiki
Jump to: navigation, search


This description/process below is for adding a new language or locale to the code base. If you want a new language added to the Pootle translation server please ask on the mailing list. You do not have to submit a BugZilla enhancement request for that.


If you plan a new localization of LibreOffice and want to have a new language or locale added, some very basic assignments and mappings have to be done to make it known to the code and the build system. Note that you don't have to edit source code if you're not familiar with this, the i18n engineer will do that for you if you submit an enhancement request as lined out below under Request a new language/locale to be added, the code places are given for reference only.

Code changes

  • The numeric Microsoft® locale identifier (LCID), here informally usually referred as MS-LangID, for attribution used by the core code and also needed for import and export of MS-Office document file formats. This is assigned by the LibreOffice project if MS did not provide an ID and thus needs to be coordinated. The ID is added to include/i18nlangtag/lang.h
  • The ISO 639 language code and ISO 3166 country code and possibly ISO 15924 script code and/or BCP 47 language tag for internationalization, API and OpenDocument Format (ODF) file storage.
  • A mapping between MS-LangID and ISO codes or language tag in i18nlangtag/source/isolang/isolang.cxx
    • If the language tag consists of only ISO 639 language alpha code and ISO 3166 country alpha code, an entry in aImplIsoLangEntries
    • Else if the language tag consists of only ISO 639, ISO 3166 and ISO 15924 script alpha code, an entry in aImplIsoLangScriptEntries
    • Else an entry in aImplBcp47CountryEntries
  • A language list box entry in svtools/inc/langtab.hrc
  • If the language uses complex text layout (CTL) an entry to i18nlangtag/source/isolang/mslangid.cxx method MsLangId::getScriptType()
  • If the language is written from right to left (RTL) an entry to i18nlangtag/source/isolang/mslangid.cxx method MsLangId::isRightToLeft()
  • Once the translation is ready an entry for the build system to build the UI localization in solenv/inc/

If your language/locale is already present in one of the language list boxes of the font attribution dialog (Format → Character → Font), probably nothing needs to be done, except maybe an entry to the build system needs to be added. If in doubt, just ask on the l10n mailing list.

Request a new language/locale to be added

To have a LangID assigned and the necessary mappings and entries added, please first login to Bugzilla and then submit an issue for Enhancement to Product LibreOffice Component Localization marked for i18n by using this URL.

Your requested language usually will be added for the next minor release of LibreOffice.

Just state that you want Language (Country) [xxx-YY] added, and if it is CTL or RTL please say so. The xxx here is the ISO 639-1 (two characters codes, preferred if one exists for the language) or 639-2/639-3 (three characters codes) language code and YY the ISO 3166 country code. If you don't know them don't mind, the responsible i18n developer (assigned issue owner) will look them up anyway. The best source is SIL ISO 639-3.

If you happen to know that MS already defined a language identifier for your language/locale you may state that as well. URLs pointing to relevant information can be found at erAck's link collection, try to pick the NLS information page first. Unfortunately MS published several resources with only partial information instead of consolidating all on just one single page. They also change their URLs from time to time, which is why this page here doesn't directly link to them. Again, it doesn't matter if you don't include the ID, the i18n developer will look it up anyway and assign an ID unique within LibreOffice if it doesn't already exist.

Locale data

Adding a language to the language list box makes it available for character attribution and spell-checking. Availability of spell checker, hyphenation and thesaurus of course depends on the installed dictionaries. To be able to fully support it as a locale, including number formats and calendar data, and having it selectable as default document language we would need a locale data file. Please see How to submit new Locale Data for details.

Language guessing feature

To make the language guessing feature aware of your language, so that right clicking on word in the wrong language offers the chance to set the likely correct language, see libexttextcat documentation for details.

Building your own changes

When you want to test your changes and already have a dev-install, you may be able to avoid rebuilding the entire project by just building the i18nlangtag and svtools modules:

make i18nlangtag
make svtools

which makes the updated libraries and resource files in the install/program and install/program/resource directories available.

Further reading

It may be that a new language requires support of new language specific features, such as script types, numbering, ... In this case check the LibreOffice Localization Guide, specifically Check support for your script and Advanced source code modifications.