Welcome to Elgg's documentation

This is the place to find documentation on all aspects of Elgg. If you would like to contribute your own documentation please do; we want this to be a real community effort!

Internationalisation

From Elgg Documentation

Contents

Internationalisation is the term commonly used to refer to the language associated with a web service. We are keen to have Elgg support internationalisation so that Elgg is available in languages other than English. The user base covers countries all over the world, therefore, it is important that everyone can use Elgg in their local language or dialect.

For this to work we are always looking for translators who are willing to help out and translate Elgg into their own language. This page will talk through the whole process of Internationalisation - the files, compiling, translating, limitations and helpful tools.

[edit] Contributing translations

Translations are made with Rosetta, a Web-based system for translating open source software into any language. You are invited to join Rosetta and start translating Elgg in your language right away.

[edit] Using Rosetta

Using Rosetta is quite easy:

[edit] Installing language packs

We try and include the latest completed translations in each Elgg distribution. However, if you've downloaded a missing translation (or have created a new one), you can install the translation files into your Elgg instance by following the instructions below.

  • Find the international language code for the patch (eg 'en' for English, 'fr' for French, etc).
  • Save the .po file into /languages/code/LC_MESSAGES/ where 'code' is the language code above.
  • Using a terminal session (eg telnet or SSH), navigate to that directory and compile the .po file with the following command:
   msgfmt -o elgg.mo code.po
  • This will create a file called elgg.mo.
  • In /config.php, modify the following line to set the default language, e.g:
   $CFG->defaultlocale = 'nl_BE';
  • As you can see with this example, gettext allows you to enter local language variations, in this case Belgian Dutch.

A simple script is included in Elgg (mod/gettext/lib/langpack.php) which can build a complete language pack for you from a launchpad.net download file. Be sure to select all files, in .po format, when requesting a download.

On windows use poedit for creating the language files open the lang.po file provide the translation for the string and save as elgg.po this is because the default domain is elgg when you save the file, poedit creates the elgg.mo automatically and then the translations work.

[edit] Customizations and plugins

Elgg translation files use the default translation domain elgg. You can change this in the main configuration file with the $CFG->translation_domain property. E.g. if you use my_domain the following file will need to be available, assuming in this case your language is French: languages/fr/LC_MESSAGES/my_domain.mo.

Plugins can have their own translation files, which will need to be located in a languages directory in the plugin directory (e.g. mod/my_plugin/languages). The translation domain for the plugin will be the plugin name, so the file which will need to be included should be called mod/my_plugin/languages/LC_MESSAGES/my_plugin.mo.

One last option for customisation is adding a second argument to the __gettext() call to override the default domain for a single string, e.g. __gettext("Friends", "my_domain").