Translations

From GeeklogWiki
Revision as of 19:50, 10 August 2008 by Dirk (talk | contribs) (Started page on how to create / update a translation)

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

Creating a new translation

Geeklog has already been translated into more than 20 languages. If your language is not among them, you may want to check for a related language first. But usually, the best way to start a new translation is to make a copy of english.php (or english_utf-8.php) and give it the English(!) name of your language.

Things to consider:

  • The character set: If you're using UTF-8, that should be reflected in the name of the language file.
  • Dialects / variations of a language: Local variations of a "main" language should also be reflected in the file name. See, for example, portuguese_brazil.php for "Portuguese, as spoken in Brazil".


Character set and text direction

Your language file should define the character set to use for your language:

$LANG_CHARSET = 'iso-8859-1';

For languages that are written right-to-left (e.g. Hebrew, Arabic), you should also set

$LANG_DIRECTION = 'rtl';

If $LANG_DIRECTION is not set in the language file, the left-to-right is assumed.


The $LANG arrays

Geeklog uses PHP arrays to define the texts used, e.g.

$LANG01 = array(
    1 => 'Contributed by:',
    2 => 'read more',
(...)
);

So whenever Geeklog needs the text for "read more", it refers to $LANG[2] and picks up the localized text from the current language file. So you only need to translate the text to the right of the => sign.

Note that some language arrays are using a textual key instead of a number, e.g.

$LANG_ACCESS = array(
    'access' => 'Access',

Again, you should only translate the text on the right side. PHP also allows text strings as an array index, so the word "Access" would be referred to by $LANG_ACCESS['access'] (and if you changed the 'access' on the left side, this wouldn't work any more).


Updating a translation

Not all language files are still actively supported. Therefore, you may notice that some texts will show up in English even when you switched to a different language. The language files, as shipped with Geeklog, are updated such that they include all the required texts. Where a translation is not available, the English text is used.

To update a translation, you can either browse through the language file and look for English texts, or you can translate texts as required as you run into them when using your Geeklog site.