Translation Tutorial

Add a new language on a site powered by PHP Pro Bid v7:

1. Copy  "en_US.mo", "en_US.po" and "en_US.php", from the "config/data/language," and rename them. Now, the files will have the same name as the locale of the language you wish to translate into.

2. Edit "config/global.config.php":

'translations' => array(
    array(
        'locale'  => 'en_US',
        'path'    => __DIR__ . '/data/language/en_US',
        'img'     => 'flags/en_US.png',
        'desc'    => 'English',
        'sources' => array(
            array(
                'adapter'   => 'CubeTranslateAdapterGettext',
                'extension' => 'mo',
            ),
            array(
                'adapter'   => 'CubeTranslateAdapterArrayAdapter',
                'extension' => 'php',
            ),
        ),
    ),
    #NEW-LANGUAGES#
),

and replace #NEW-LANGUAGES# with:

array(
    'locale'  => '%LOCALE%',
    'path'    => __DIR__ . '/data/language/%LOCALE%',
    'img'     => 'flags/%LOCALE%.png',
    'desc'    => '%LANGUAGE-NAME%',
    'sources' => array(
        array(
            'adapter'   => 'CubeTranslateAdapterGettext',
            'extension' => 'mo',
        ),
        array(
            'adapter'   => 'CubeTranslateAdapterArrayAdapter',
            'extension' => 'php',
        ),
    ),
),

where %LOCALE% is the name of the language files you will add, without any extension, and %LANGUAGE-NAME% is the name of the language.

3. Use a gettext editor (eg.: Poedit) to translate the sentences from the .po file.

4. In the website's admin area, go to "Site Content" > "Edit Language Files", select language from the right drop-down, translate all sentences from the left text box and paste them in the right text box.

5. When upgrading to a new version, to upgrade the translated .po file, open Poedit and access "Catalog" > "Update from POT File" and select the English .po file from the latest update. Any new sentences will appear in the .po file.

Important: If a sentence appears in both files, please note that the array adapter (php file) has a higher priority .