|Version 1 (modified by rats, 6 years ago) (diff)|
The Way to Translate ispCP
If you've translated Unix/Linux? applications before, you might already know the GNU gettext tool library. If you do, you can immediately start translating by using the .po files in the languages-files directory. If you are new to the GNU gettext tool library and concepts, read on.
How comfortable the new Way is
ispCP is currently translated using the GNU gettext tool library. Strings are directly edited in the source code, and are extracted after the development so translators can directly translate the strings. In the past, we have had so-called language variables. However, this system had a few drawbacks. Every time a new string was added, modified or removed in ispCP, developers had to create a new language variable which afterwards had to be translated.
How to translate
When the development of a new ispCP version has been finished, developers extract all strings using a special tool into so-called language files. These files can be found in the directory ./language-files/. All files with at least one translated line are located under their 639-1 ISO Language Codes. All codes can be found under http://www.loc.gov/standards/iso639-2/php/code_list.php If you open a .po file, you'll see the default messages and their translation:
# #, fuzzy msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2007-07-06 16:02-0500\n" "PO-Revision-Date: 2007-07-06 16:02-0500\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: English <en_GB@li.org>\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n" "X-Generator: x64PoPot 0.2\n" #. Please ignore this entry msgid "encoding" msgstr "UTF-8" msgid "_: Localised language" msgstr "English" msgid "ISPCP - Virtual Hosting Control System" msgstr ""
You can ignore the first lines, as they are not important for translation, however you can add your personal infos to show anyone, you've translated the file and the credits go to you. The important lines are "msgid" and "msgstr". The "msgid" specifies the source text, and the "msgstr" the translation. Thus, it's very easy to translate as you always see the original text and your translation. You can also use poEdit which is a graphical front end to .po files and available for both Linux and Windows..
How to Integrate the Translation
You can test your translation by running the application "msgfmt":
msgfmt <LANGUAGE>.po –o <LANGUAGE>.mo
You have to replace LANGUAGE with the file name.
This command compiles the textual .po file into a binary one called .mo file. This has to be done for performance reasons. If you can't run msgfmt yourself, just send your translated .po file to us with the remark that you'd like to receive a compiled .mo file, and we'll return the .mo file to you. If you are using poEdit, you don't need to call msgfmt yourself, poEdit does that for you.