How to translate more.groupware
From MGWiki
This document describes the way of localize more.groupware or special modules of more.groupware. It should give the reader the chance to add a complete new language to more.groupware or to a module within the more.groupware framework.
Contents |
Structure of more.groupware
The graphic below demonstrates the directory structure of more.groupware. On the first level you have the modules, in the shown tree you can see the module "admin"; and the module "calendar". There are also some folders which are on the first level which are not a module but other application based directories, but thats not the focus of the document. We will use the "calendar" module for a detailed explanation:
The lang folder contains language files for a certain language.
A more.groupware language file has the following file name: m.x.lang, where m = module name, x = international language code.
Important: Each module has this language structure, or at least, it must have it to be more.groupware compliant.
more.groupware lang-file
The more.groupware language file conists of 2 parts, the key and the text. The parts are seperated by an equal (=) sign. Below is a simple example of an english and a german language file:
english lang-file from calendar module (calendar.en.lang)
collisionwith = collision with date = Date dateconflict = dateconflict desc = Description dobook = book
german lang-file from calendar module (calendar.de.lang)
collisionwith = kollidiert mit date = Datum dateconflict = Terminkonflikt desc = Beschreibung description = Beschreibung dobook = buchen
As you can see only the right side of the "=" sign will be modified. So if you want to create a new language file for a module or for all modules, you must copy an existent lang file you understand (i assume english) to a new file named calendar.it.lang, if you want to translate to italien, or to calendar.ru.lang if you want to translate to russian. Then modify the file and edit the text on the right of the "=" sign on each line.
Using newslines for long text
As you can see, this is not very comfortable for long texts, because you may have to scroll to the right if you have two or more sentences. Because of this you can insert newline and continue your text on the next line, the following example demonstrates this:
collisionwith = collision with another appointment, and this is not all. There was also a collision with my car the morning before, but this is only important to mention because i want to insert a really long text for the keyword collisionwith date = Date
You can see that the key "collisionwith" has a very long text and in fact it doesnt matter, moregroupware will handle this situation without any problems.
Variables inside lang files
The more.groupware framework is capable of having variables inside text. This is very important because when more.groupware wants to display something like: "User Thomas Smith found 10 Contacts from 122", the text consists of normal text which must be translated and of variable parts like username (Thomas Smith) and records found (10 and 122). In order to handle this, the lang file can look like the following example:
myheader = User <$1> found <$2> Contacts from <$3>
or the german one:
myheader = Benutzer <$1> hat <$2> Kontakte von <$3> gefunden
Here you can see that more.groupware has no problems with different sentence structures, because you can place the variables wherever you want.
When adding a completely new language...
Your first module must be the setup. The langauge files for setup have one special line at the beginning, that tells the setup about the name, code and charset of the language. So you need to translate setup first, make sure this line is correct and then run setup to insert the language in the system.
The next module you translate should be "settings". Because when you add a new language and you translate only a module like calendar, moregroupware will fail in the same second when you switch your personal language to the new one. This is because the switching itself occurs in the module "settings" and before you have the chance to change to your translated module, moregroupware will search for a translation of "settings".
Test new language
If you have sucessfully translated a module for more.goupware, which means you have added a new file for example "calendar.it.lang" (italian) to the lang directory of a module (calendar). You can check out your translation by following the steps below:
- Run the following SQL against your more.groupware database (Can be avoided by translating setup first!):
INSERT INTO mgw_languages (langcode, description, charset, active, lu_user, lu_date) VALUES ('it', 'Italian', 'iso-8859-1', 1, 0, NOW());
- Open more.groupware and go to "settings" and "personal settings"
- Change your language to the one you just created
- Go to your translated module and check the results


