Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

The sipXecs startup scripts can be localized by generating and installing message catalogs containing prompts translated for various languages and regions. The scripts are written in Python, and use the GNU gettext localization method. This page describes how to generate prompts are generated in a new language.A

String externalization support

Some of the setup scripts labels are externalized into a sipxecs-setup.po (Python Portable Object Template file containing the list of strings to be translated can be generated from the source by running

Code Block

   xgettext -L python --output=sipXecs.pot sipxecs-setup.in sipxecs-setup-system.in sipxecs_setup_common.py.in

in the sipXpbx/bin source directory.

This template file should be translated into Portable Object files called sipXecs.po in the appropriately named subdirectory under ) file located in sipXpbx/bin directory

Sample

Code Block

msgid "setup.initial"
msgstr "This wizard creates the bootstrap configuration for sipXecs. Any existing configuration will be overwritten if you continue."

msgid "setup.title"
msgstr "SipXecs System Setup Wizard"

msgid "setup.start"
msgstr "Start sipXecs Services Setup"

Setup scripts contain keys as above, instead of strings for the externalized text string values. Through python localization mechanism
these keys are replaced with text at runtime

During sipXpbx build time, the sipxecs-setup.po is compiled into a Python Machine Object localization file: sipxecs-setup.mo
and automatically locates it here: $INSTALL/share/sipxecs/locale/en_US/LC_MESSAGES
We are using a python script for this compilation as follows: msgfmt sipxecs-setup.po --output-file=sipxecs-setup.mo

In future we will externalize all strings in the dedicated sipxecs-setup.po

Localization support

Other languages can be added (sipxecs-setup.po file), and the directory location should match to the following template:
$INSTALL/share/sipxecs/locale/<locale_code>/LC_MESSAGES/ (e.g. fr_FR). Use the UTF-8 charset and 8bit encoding. The Portable Object files should then be converted to Machine Object message catalogs by running, in the

Python has an automatic fall-back chain, so when a key-value pair is not found in a particular localization file automatically
falls-back to the corresponding en_US key-value pair. If this one still does not exists the string from setup script is displayed

OEM support

The default en_US localization .mo file can be overwritten by the OEM version
So if you use a OEM plugin, you can provide your own key-value pairs instead of the existing en_US version

Locate your OEM sipxecs-setup.mo here: $INSTALL/share/sipxecs/locale/<locale_code> directory,

Code Block

   mkdir -p LC_MESSAGES
   msgfmt.py --output-file=LC_MESSAGES/sipXecs.mo sipXecs.po

(Note that msgfmt or msgfmt.py may be run. These utilities must be installed separately).en_US_OEM/LC_MESSAGES/

The Python fall-back rule is as follows:

other locale -> en_US_OEM -> en_US -> default script string value

Currently there are no translation files available.