Table of Contents
Localization
phpDiveLog already ships with translations for several languages - but except for German and English, which are maintained by the developer himself, they may either be not up-to-date, or the language you are looking for is missing completely. While this may sound hard, it is not difficult to solve.
The Translation System
Translations are read from "plain text" files in CSV format, which you find in the lang/ directory of your PDL installation. To also serve incomplete/missing translations, phpdiveLog always falls back to English if it cannot find a term. Which means two things:
- the English translation file must be the most complete one
- if a term in your language is the same as it is in English, it can be omitted in your translation file
Editing Translations
If your language is completely missing, you best start with a copy of the lang/trans.en file. As you may already have noticed, the file extension represents the ISO language code, so name the copy appropriately. For example, if you want to start on an Italian translation file, name it trans.it. Remove all translations which will be equivalent to the English ones, and replace the remaining translations with the Italian ones.
If your language is already presented by an (incomplete) translation file, simply copy the missing lines from the English file (new terms are usually simply added to the end, so it should not be that hard to tell), and continue as in above example.
Important: Never ever remove the first line (which specifies the "column" names), or your translations won't work. The same applies to the values of the first column, since this is how phpDiveLog identifies the terms.
Adding a new Language
For this, just follow the description above — starting with the creation of a new language file. When all translation work is done, and the new file is saved to the lang/ directory, the new language with its translations is immediately available. However, it may not have a flag associated on the preferences page. For this, generate the matching flag (or download it from somewhere). Make sure the image size is about 30x20 pixels, it is a *.jpg file, and its name is lang_XX.jpg - where XX represents the corresponding language code (for the above example, this would result in lang_it.jpg). Place it into the templates/*/images directory, and you are done.
Please, don't forget to send your language file to the project, so we can include it into the next version to be used by other people as well.
