Localizing the setup scripts

Obsolete

Only relevant to release 4.4 or older

 

 

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 prompts are generated in a new language.

String externalization support

Some of the setup scripts labels are externalized into a sipxecs-setup.po (Python Portable Object) file located in sipXpbx/bin directory

Sample

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.moo file), and the directory location should match to the following template:
$INSTALL/share/sipxecs/locale/<locale_code>/LC_MESSAGES/ (e.g. fr_FR)

Python has an automatic fall-back chain mechanism, 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

Currently there are no translation files available.

OEM support

The default en_US localization .mo (sipxecs-setup.mo) file key-value pairs can be overwritten automatically at run-time
by the OEM corresponding key-value pairs from the OEM sipxecs-setup.mo
So if you use a OEM plugin, you can provide your own key-value pairs instead of the existing en_US.

Locate your OEM sipxecs-setup.mo here: $INSTALL/share/sipxecs/locale/en_US_OEM/LC_MESSAGES/

The Python fall-back rule is as follows:

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