Introduction to Translations - xenocrat/chyrp-lite GitHub Wiki
Chyrp Lite uses PHP's gettext extension (where available, and its own gettext shim on Windows servers) to translate all the text it displays to visitors. If you would like to create a translation for Chyrp Lite, you can use the template files provided with each release to do a translation using any gettext-compatible software such as Poedit.
Three things are needed for translations to work:
- Your server must have support files installed for your choice of locale.
- Your (non-Windows) PHP environment must be built with GNU gettext support.
- You must create a compiled translation file (ending in .mo extension).
Translation Domains
Chyrp Lite is split into multiple translation domains for the text strings in its core, administration console, feathers and modules; each domain has its own locale folder containing a template file (.pot) that you can use to create a translation file (.mo) for the corresponding component.
Setting the Locale
The language used by Chyrp Lite is determined by your choice of locale. The locale also affects other things, such as how dates and numbers are displayed on your blog.
Locales can be selected on the Settings > General page of the administration console if a valid locale subfolder is present within includes/locale/. In order to install or test the translation file for an extension, be sure the corresponding locale subfolder exists within includes/locale/ beforehand so that you can enable the locale you want to test. A locale subfolder is not required to contain a translation file.
Locale subfolders must match the name of a locale option available on the host system, and be named using a two-letter ISO 639-1 language code followed by an underscore ("_") or a hyphen-minus ("-") and then a two-letter ISO 3166-1 country code.
Platform-specific quirks
Chyrp Lite will try a few tricks to set the locale successfully despite platform-specific quirks on a variety of host systems. For example, if you select "English (United States)" as your locale, Chyrp Lite will attempt to set the following locales until one succeeds:
- en_US.UTF-8
- en_US.utf-8
- en_US.UTF8
- en_US.utf8
- English_United States.utf8
Installation and Testing
There are a number of requirements to successfully install and test a translation file:
- Create a locale subfolder with a valid name within the component’s locale folder.
- Within the newly created folder, create another subfolder named LC_MESSAGES.
- Save your translation in LC_MESSAGES with the same domain name as the original.
- Go to Settings > General to switch locale so that your translations will be used.