I had to translate osTicket 1.7 to german since the company I am employed at plans to use it. To make translation easy and adaptable for future updates i used gettext. Since i already had to do the work, i thought i should share it.My modifications are:
- Pretty much every text in the .php files is encapsulated in the short version of the gettext function ('__()').
- Added a central configuration file for the translation settings
- Added a fallback function, for the case, that the gettext extension isn't loaded
- Simplified some of the texts by using sprintf
- Added language detection based on browser preferences (thanks to Darrin Yeager)
- Included php_gettext (since RC6_V5)
- The german translation file
Now to the interesting stuff:Which version of osTicket was modded:
osTicket 1.7 RC6
osTicket 1.7 StableHow to use it:
Unzip it and put the folder on your webserver. In the most cases that should be it. However if multilanguage still doesn't work check if you have the mbsting extension activated. Also check your file permissions. Installing other mods will be a bit harder.What is translated:
All of the important php files.What is not translated:
The email-templates (you'll have to translate them via admin panel)
Generally the sql-schema used in the setup/upgrade. I can't do that since the md5 of the sql file is checked. Changing it would break the upgrader.What also doesnt work:
Language detection in emails. I don't really know how to do that or if it is actually possible.Currently supported languages:
- english (is the fallback)
- germanHow to set a static language:
Set the line in 'include/gettext-conf.php' that contains
How to add more languages:
You'll find a tutorial here: http://thane.dyndns.org/osticket_mod...n_tutorial.htm
NOTE: When you translate some of the texts they may not show translated in your webpage. In that case you'll probably have to restart your webserver. Gettext seems to cache its contents.
Also, you'll need time and patience (a lot of it).Gettext:
There are two gettext based engines supported right now. Primarily a pure php based engine will be used (already included and configured, it requires the mbstring extension). The Gettext Extension is too picky with the language codes in some cases (see gettext extension), which leads to no translation at all.Gettext extension:
You should only use the extension if you know what you are doing. Although it brings a slight performance boost it'll make maintenance of multiple languages harder.Windows:
You have to add the gettext extension in php.ini if you want to use the multilanguage feature.
Remove the ;
in the line ;extension=php_gettext.dll
to enable the gettext.
You'll also have to disable php_gettext by changing
I don't exactly know how to configure gettext on a linux server. The following is what some sites said about configuring gettext:
Your distribution may have a PHP version with precompiled gettext. If that isn't the case you'll have to compile php with the parameter --with-gettext.
Linux users that compile PHP --with-gettext=shared should include
extension=gettext.so in your /etc/php.ini
You'll also have to disable php_gettext by changing
If after that the translation doesn't work your webserber/os probably doesn't like the language code it gets. You can see the supported language codes by executing the following command in your terminal Redirecting Language Codes:
To redirect a language code to a different one, create a folder inside 'include/locale' that represents the language code you want to redirect and then create a file called 'redirect' in it. The content of 'redirect' has to be the language code it should redirect to.
You want to redirect the language code 'de-de' to the code 'de' create a folder inside 'include/locale' called 'de-de'. then create the file 'redirect' in it. the path to this redirect should now look like 'include/locale/de-de/redirect'.
Now open the redirect file you've created, type de in the first line and save it.
To see how the osTicket is translated use testlang.php. It also shows language redirections, if there are any.
NOTE: A language code can be redirected only a single
If you find any bugs or have any questions please tell me/post them here.Changelogs:
whole changelog list: http://thane.dyndns.org/osticket-ml-changelog.htm07.05.2013 (osticket_1.7-stable_multilanguage_V6):
- Added the suggestion of olest to ease setting the encoding of translations in gettext-conf
- Also added the untranslated string olest found
- Ported this mod to 220.127.116.11
- Updated German translation file (thanks to hhm, Sweeny)
- Note: there were a few changes in texts (about 90) and the "Site Pages" were added, which can't be translated with gettext, since they reside in the database.
- Ported this mod to 18.104.22.168
- Updated German translation file
- Note: there was another change in texts (the "Howdy,")
- Ported this mod to 1.7.2
- Added the changes suggested by olest
Downloads:osticket_1.7.2-stable_ml_V10Old Links (do not use those in production environments):osticket_1.7-RC6_multilanguageosticket_1.7-RC6_multilanguage_V2osticket_1.7-RC6_multilanguage_V3osticket_1.7-RC6_multilanguage_V4osticket_1.7-RC6_multilanguage_V5osticket_1.7-stable_multilanguageosticket_1.7-stable_multilanguage_V2osticket_1.7-stable_multilanguage_V3osticket_1.7-stable_multilanguage_V4osticket_1.7-stable_multilanguage_V5osticket_1.7-stable_multilanguage_V6osticket_1.7.1-stable_ml_V7osticket_22.214.171.124-stable_ml_V8osticket_1.7.2-stable_ml_V9
- Added missing changed pictures and removed extra files