phTagr supports multi-languages since r523. Translations are done similar to the  gettext mechanism, which uses specific translation tables. These translation tables could be created, edited, and updated with e.g. the handy  poEdit editor.

Create translation file in your language

Your language is missing? You can create with an PO editor (like poEdit) and submit the complete translation to [ translation@phtagr.org].

Following example is given with  poEdit (available for Windows, Linux, or Mac):

  • Download current root translation table file from the SVN trunk: default.pot
  • In poEdit goto File -> New Catalog from POT file...
  • Select the default.pot file
  • Enter your name, email address, your language and country to the setting form (source code charset is utf-8)
  • Start translating
  • Send your default.po and default.mo to translation [AT] phtagr.org to submit your contribution to the source code
  • Feel happy! You did a great contribution

If you're updating or correct a translation, open the translation file default.po of your language and download the current root translation file from trunk default.pot. Select Catalog -> Updated from POT file... in poEdit and translate the updated strings. Send again your translation to the translation team of phtagr, to submit your contribution to the source code.

Test your translation

Copy your translation files to the correct location of your phtagr installation. The folder structure is given below. See  ISO 639-3 language codes for your language. Eg. ita for Italian, tha for Thai.

To test your translation within your browser, your browser must send the correct Accept-Language HTTP request header for the automatic language selection. With [www.mozilla.org Firefox] you might be able to change this HTTP request header via the about:config page. Change the intl.accept_languages value to your language and watch your translation.

Update Your Language

You do not need to translate all texts if some translation is already done. Here are the steps to update or complete a translation file

  • Open your translation file from app/locale/[your country code]/LC_MESSAGES/default.po
  • Goto poEdit's menu "Catalog" -> "Update from POT file"
  • Open the phtagr's base translation file from app/locale/default.pot

These steps merge phtagr's translation to your translation texts. You should have some text "25 new, 3 obsolete" in this merge dialog. Now you can translate these 25 new text entries and save the file and send it to [ translation@phtagr.org] or commit it.

Folder structure

The translation files are stored in ./phtagr/app/locale/language code/LC_MESSAGES/default.[pm]o.

/phtagr       
    /cake        <-- CakePHP framework
    /app         <-- phTagr as CakePHP's default application
        /locale  <-- Folder of tranlation tables
            /eng <-- Language folders (format of ISO 639-3 or language codes in ll-cc format, e.g. en-US)
                /LC_MESSAGES
            /deu
                /LC_MESSAGES
                    default.po <-- Portable Object file, human readable translation table
                    default.mo <-- Machine Object file, final translation table file
            ...
            default.pot    <-- Root translation table

Automatic Language Selection

 cakePHP selects the language according to the Accept-Language HTTP request header. If the translation is not present, it uses the default string, which is mainly (some sort of) English.