glFusion Wiki

Site Tools


glfusion:language:translating

Translating glFusion

Creating a new translation

glFusion has already been translated into several languages. If your language is not included in one of the existing translations, the best way to start a new translation is to make a copy of english_utf-8.php and give it the name of your language.

Language files uses the following naming convention:

  • <language>_utf-8.php
  • <language>.php

Where <language> is the English name of your language.

Character Sets

By default, all new installations of glFusion use the UTF-8 character set. When translating language files, it is recommended that you always start with the <language>_utf-8.php files first.

Things to consider:

  • The character set: If you're using UTF-8, that should be reflected in the name of the language file (i.e. the filename should end in …_utf-8.php).
  • 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”.

Language file

glFusion includes several language files for different purposes. There is a main language file, used by glFusion's core code. The plugins that are bundled with glFusion (and all 3rd party plugins) use their own language files. Another language file is used by the install script:

  language/english_utf-8.php
  plugins/bad_behavior2/language/english_utf-8.php
  plugins/calendar/language/english_utf-8.php
  plugins/captcha/language/english_utf-8.php
  plugins/ckeditor/language/english_utf-8.php    
  plugins/filemgmt/language/english_utf-8.php
  plugins/forum/language/english_utf-8.php
  plugins/links/language/english_utf-8.php
  plugins/mediagallery/language/english_utf-8.php
  plugins/polls/language/english_utf-8.php
  plugins/spamx/language/english_utf-8.php
  plugins/staticpages/language/english_utf-8.php
  public_html/admin/install/language/english_utf-8.php

You don't need to translate all the language files at once. The plugins will fall back to using the English language file automatically when they can't find a file for the current language.

It is best to start with the main language file (in the toplevel language directory) and work your way from there.

Character set and text direction Your language file should define the character set to use for your language:

  $LANG_CHARSET = 'utf-8';
  $LANG_LOCALE  = 'en_US';

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, left-to-right is assumed. Note: These two options should only be set in the main language file and the language file for the install script. Plugins will automatically use the character set and text direction as defined in the main language file.

The $LANG arrays

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

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

Whenever glFusion needs the text for “read more”, it refers to $LANG01[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 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 glFusion, 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 glFusion site.

Getting help

Visit the glFusion forums for assistance with translations.

Publishing your translation Upload to glFusion DOT org Sending Patches How to do pull requests

To discover language differences between release versions of glFusion, you can use the diff tool in the glFusion GitHub Project Page to compare a release version with a previous release version.

Please submit any translations to http://www.glfusion.org so they can be included in future releases. Additionally, you can also use the Translation forum to discuss questions or to collaborate with other users on translating glFusion.

glfusion/language/translating.txt · Last modified: 2017/05/16 04:06 (external edit)

Page Tools