Login :: Sitemap :: Contacts

 SUMO Homepage > Documentation > Developers > Translate SUMO into other languages
Translate SUMO into other languages
This translation guide constitutes an introduction to the language system in SUMO and its purpose is to assist language pack developers in getting started.
The new module design would facilitate higher quality translation of application content by allowing volunteer translators to work with easy.


SUMO Access Manager have two types of language mamagement:
  • a "core-language" for a basic application interface, to logging messages, etc...
  • a "module-language" for a specific module interface.
Core Language Packs
The complete core localisation for a particular language consists of some PHP files grouped in the one specific language directory to ease the maintenance of the files, for core language the directory is <sumo_dir>/languages/<language_code>/.

For example English is:

<sumo_dir>/languages/en/
                        |-- index.html
                        |-- lang.console.php
                        |-- lang.core.php
                        `-- lang.login.php

On SUMO 0.2.11 there are three languages files, that are divided up to improve performance and address scalability:
  1. lang.console.php is a language file for the console framework.
  2. lang.core.php is a language file for the core components, core modules, core plug-ins .
  3. lang.login.php is a language file only for the login page.


Module Language Packs
The module language design is very simple, each application module (Users, Sessions, etc) have only one file for each available language into languages module directory.
In this example "Users" module have three files for English, French and Italian languages:

<sumo_dir>/modules/users/languages/
                                  |-- index.html
                                  |-- lang.en.php
                                  |-- lang.fr.php
                                  `-- lang.it.php

Read "Language File Formats" section for details about "language-code" and other.



Language File Formats
Each language file use a php multidimensional array to define with "key" the alias for program interface, and with its "value" the language phrase.
Syntax is:

...
"ALIAS" => "translated text string",
...

Note that the ALIAS is case-sensitive.

In English, the alias and the text are typically the same for short words. For longer words and phrase, the alias may be a shortened key to reference the full phrase. For example:

...
"User"     => "User",
"Password" => "Password",
...
"CannotModifyAccount" => "You cannot modify this account!",
...

To complete a phrase with dynamic data, some phrases have the label {{DATA}} in the position of this data is and if the phrase have only one dynamic content, otherwise {{DATA<number>}} for more than one (with a progressive number that start from 0), for example:

...
'UserAlreadyExist' => 'User {{DATA}} already exist',
'AreYouSureDelete' => 'Are you sure to delete group: {{DATA0}} ({{DATA1}}) ?',
...

At last, some alias like errors messages is a cryptic code for developer, therefore, to understand better how to translate it watches the version of the file in the language that you know.

For example from English:

"I01000X" => "User account {{DATA0}} updated by {{DATA1}}",

to Italian:

"I01000X" => "Account utente {{DATA0}} aggiornato da {{DATA1}}",



Creating a new Core Language Packs
The method to create a new core language file is to copy the original English directory, to change their directory name prefix to the new language code and then edit all the texts of each file after the "equal-major" signs.
The ‘language-code’ is based on the ISO-639-2 standard for 2 letter language codes (always in lowercase), then copy into this directory your language files.
You MUST keep the ALIAS the same in your new files.


Creating a new Module Language Packs
As above-mentioned, module language have only one file for each available language into languages module directory that use this syntax name: lang.<language_code>.php.

The method to create a new module language file is to copy the original English file of specific module, to change their file name with the new language code and then edit all the texts of this file after the "equal-major" signs.
As above-mentioned, you MUST keep the ALIAS the same in your new files and the ‘language-code’ is based on the ISO-639-2 standard for 2 letter language codes (always in lowercase) then copy into this directory your language files.


The best practice to add support for a new language to SUMO Access Manager is to create both languages packs (Core and Modules). Every aid will be appreciated!