osTicket/osTicket-1.8 — pull request #17 by t-oster (2013-10-15 11:18:21+00:00)
Title: Add generic translation method and translate templates.

As suggested in #1, I would like to provide a generic "t" method, which works like printf, but translates everything.
The advantage is, that you can use any mechanism you like to translate and the method name is very short, keeps templates readable.

Here is a simple implementation using an associative array for each language. I also added a language-select panel in the header.

Details:
* The file "include/translation.php" provides the global methods "t" and "st", which work like printf and sprintf, but translate the content if possible.
* The code for translation is encapsulated in the class "localizer", which is also in the "include/translation.php". It provides the following methods (as singelton):
** getLanguages() - returns a list of installed languages
** setLanguage($lang) sets a specific language and saves it in the session. All subsequent calls to "t" and "st" will be translated according to that language.
* each language is a single file called "include/i18n/$lang/lang.php". It just contains the declaration of the associative array "$this->translations = array ("" => "");