Translation Tutorial

To add a new language on PHP Pro Bid v7 powered website, you will need to take the following steps:

1. Copy the following files: "en_US.mo", "en_US.po" and "en_US.php", found in "config/data/language", and rename them so that they will have the 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'   => '\Cube\Translate\Adapter\Gettext',
                'extension' => 'mo',
            ),
            array(
                'adapter'   => '\Cube\Translate\Adapter\ArrayAdapter',
                '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'   => '\Cube\Translate\Adapter\Gettext',
            'extension' => 'mo',
        ),
        array(
            'adapter'   => '\Cube\Translate\Adapter\ArrayAdapter',
            '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 your website's admin area, go to "Site Content" > "Edit Language Files", select your language from the right drop-down, and translate all the sentences from the left text box and paste them into the right text box.

5. When upgrading the software to a new version, to upgrade your translated .po file, you will need to open Poedit and access "Catalog" > "Update from POT File", then select the english .po file that is provided in the latest software update. Any new sentences will appear in your .po file.

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