Skip to content

Internationalization

kip9 edited this page Apr 1, 2014 · 3 revisions

Introduction

Starting from version 1.4 Unmark has become fully localized. This page describes how to set up translated version of the site, and how to work on new translations.

Technical details

Translations for Unmark are created using gettext library, which is a native solution ported to PHP using loadable module. In order to run localized version, you'll need to enable gettext extension with your PHP install. Due to the fact how gettext uses native functions in PHP extesions, you'll need to have UTF-8 encoded set of locales generated on your server for the language, you'd like to use. Otherwise translations won't load and you'll end up with original language, which is English.

Working on translations

In order to create new translation, you'll need to start with a .pot file. This file is in our github repository under

application/language/unmark.pot

folder. We recommend using POedit to work on translations.

After importing .pot file, and creating new translation, you end up with .po and .mo files. Those should be placed under

application/language/locales/${LANG}/LC_MESSAGES

folder as unmark.po and unmark.mo respectively. ${LANG} is a language shortcut (ie. en_US, pl_PL, de_DE) without encoding postfix.

After placing all files in proper locations and generating UTF-8 locales for corresponding language on the server, you need to update application config, to fill info about new language. Proper settings are in the file:

application/config/all/language.php

Config entries to change:

  • $config['supported_languages'] - add a key => value entry to the array, where key is language identificator (for example 'de') and value is language shortcut from locales (for example 'de_DE')
  • $config['default_language'] = 'de'; - where 'de' is the key from the array above

One more thing you need to keep in mind is that webserver may cache the gettext translation files. So if you made changes to .po or .mo files, and they are not visible - try restarting your web server (or PHP process pool in case you're using *CGI install of PHP).

Extra information