From OpenDCIM Wiki
Revision as of 05:42, 22 July 2016 by Scott (Talk | contribs) (Locales)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Enabling Language Translation on Your System

In order to properly manage translations, openDCIM utilizes the standard open source utility called Gettext.

To ensure that you have GetText installed on your system correctly, run the following command:

 $ echo "<?php error_reporting(0); print phpinfo(); ?>" | php | grep "GetText"

You want a response of:

 GetText Support => enabled

If not, you'll need to search your particular distribution's documentation for how to install GetText both at the system level and to enable it within PHP.

Important note! If you wish to interact with the template repository, you must install en_US.utf8 locale on your system, as all templates are in that format.

Locales

A dependency of Gettext is that the locale for the language that you wish to support must be installed on your server. This is basically a mapping of the character sets so that extended characters may be displayed properly.

See what locales are currently installed on your system:

 $ locale -a
 C
 C.UTF-8
 en_AG
 en_AG.utf8
 en_AU.utf8
 en_BW.utf8
 en_CA.utf8
 en_DK.utf8
 en_GB.utf8
 en_HK.utf8
 en_IE.utf8
 en_IN
 en_IN.utf8
 en_NG
 en_NG.utf8
 en_NZ.utf8
 en_PH.utf8
 en_SG.utf8
 en_US.utf8
 en_ZA.utf8
 en_ZM
 en_ZM.utf8
 en_ZW.utf8
 POSIX

Above is the output on an Ubuntu system installed for English. You'll noticed that other than POSIX and C, only en_ prefix locales are present.

If you wish to install another locale, such as Traditional Spanish (es_ES), you would do the following:

 $ sudo locale-gen es_ES.utf8

The postfix of .utf8 is important as that is the character encoding we use for internationalization. If you simply installed the es_ES locale then some characters may not display correctly.