print Using the Scorpio Translation system

Building a language resource file

Depending on your chosen language format, this next step will be either easy or pretty difficult. If you are using: Array, INI, CSV, Gettext, Xliff, QT or TMX then you are in luck, and can use the built-in extract tool in the main Scorpio CLI tool.

If you are using TBX or XMLTM, you will need to build one of the other formats first and then transform that into TBX or XMLTM - something beyond the scope of the Scorpio framework and this article.

Presuming that you have one of the supported formats, the next step is to run the extraction utility over the website. This is part of the core scorpio.php CLI tool that is located in the /tools folder of the main distribution. To run it you will need a correctly configured PHP CLI binary (Windows and Linux are both supported - as is Cygwin on Windows). You should be able to run: php -i and see the PHP version information before proceeding.

The extraction tool has a lot of options, so before running it you should review the help information. This can be accessed by running from within /tools:

php scorpio.php help extract i18n

As we are using Smarty and a website this means we will need to specify the following parameters:

Then if you did not use {t}{/t} as the markup, you will also need to specify

With all those specified hit enter and the website language data will be extracted into the specified format and saved into a file under the website folder in /libraries/data/[LOCALE]/. From there you can check the contents, edit the strings for translation or send the files to be translated.

Note: once this step has been done you should NOT change the text in the templates. If you do, the language data will need to be re-extracted as the look-up keys will have changed. Alternatively: you can manually edit the language files.

During development it is likely a good idea to provide at least one translated file - even if it is just a partial translation for testing.