Difference between revisions of "Developer Area/Language Packs/Structure"
From Mahara Wiki
(Created page with "There are several types of Mahara plugins that can hold their own translation. They are defined in a function plugin_types(), see lib/mahara.php. At the time of writing this, sev…")
Revision as of 18:56, 9 May 2011
There are several types of Mahara plugins that can hold their own translation. They are defined in a function plugin_types(), see lib/mahara.php. At the time of writing this, seven plugin types are known:
- grouptype (new in 1.1)
Every plugin type has got its own directory in the root of Mahara htdocs. Within these root directories, individual plugins have their own subdirectories, eg:
Every plugin defines its own strings in the English language file. This is located within 'lang/en.utf8' subdirectory of the plugin, eg:
As you can see, string files are spread around the source code tree (compare to Moodle approach where all string files are centralized into the /lang directory). The strings used by the Mahara core itself are defined in the folder
One of the files defined there is the language configuration file langconfig.php.
There are two possible ways to store your translation string files: having the language pack stored in a separate folder-langpacks-, out the Mahara code tree, or having each of the language string files stored next to the English ones, at the pluggin level. The dominant tendency among Mahara translators is the first one- installing the language pack in a separate langpack folders, which makes easier the code upgrades.
In the following text, let us expect your language code is xx. Replace xx with the code of your language (eg. 'cs' for Czech, 'de' for Deutsch etc.).
1. Having language pack out of the Mahara source code tree
In this case, the whole hierarchy of all htdocs/type/plugin/lang/xx.utf8 folders is taken out of the Mahara source code tree and pasted into a separate location of your choice. There is a directory in Mahara's dataroot directory called 'langpacks' that can be used for this purpose without any configuration, as Mahara looks in there for directories matching *.utf8 to use as language packs. Given that you decide to have your language pack within maharadata/langpacks/xx.utf8 you will have string files in locations like
The structure of the folders within maharadata/langpacks/xx.utf8 has to correspond to the structure of the folders as would be in the first case described above. It means you can always move/copy your language pack from maharadata/langpacks/xx.utf8 into the standard Mahara source code tree.
If you want to have your language pack both out of the Mahara source tree and not within dataroot, you can use the configuration variable 'langpacksearchpaths' to add your own directories where language packs exist. You can set this in config.php by adding a line like so:
$cfg->langpacksearchpaths = array('/home/me/languagepacks/xx.utf8');
As you can see, this variable is an array, meaning you can add more than one path if necessary.
2. Having language pack at the plugin level
Warning: This information is only valid for earlier versions of Mahara, prior to 1.2
You can have your files "next to the English ones", ie.:
By this way, you can distribute your contrib plugins together with their translations bundled. On the other hand, from the translator's point of view, this leads to the situation that your Mahara installation is a mixture of a standard distribution tree with a lot of directories added by yourself. Of course, this makes the distribution of the whole language pack more difficult.