Translation

From GroupScript documentation

Jump to: navigation, search

Translation instructions

Prepare folder structure

  1. First step is preparing folder structure. You need to find out what is the language code for the language you want to translate GroupScript in and also- country code. For example, language code for Russian language is ‘ru_RU’, Turkish is ‘tr_TR’, Japanese is ‘jp_JP’, Greek is ‘el_GR’ etc. Please see most commonly used locale codes to find out what locale to use for your language/location.
  2. Create a folder in system/locale/<language_code>_<country_code>
  3. Copy the folder ‘LC_MESSAGES’ from system/locale/en/ to system/locale/<language_code>_<country_code>

The directory structure should look like this:
system/locale/
|– en
| `– LC_MESSAGES
| |– grouponscript.mo
| `– grouponscript.po
`– ru_RU
`– LC_MESSAGES
|– grouponscript.mo
`– grouponscript.po

Translate texts

  1. Use freeware software Poedit to translate the grouponscript.po file in the folder you just created. Poedit can be downloaded here: http://www.poedit.net/index.php
  2. Very important: in Poedit's settings, set Plural forms as required for your language. See this page for list of plural forms by languages, http://www.gnu.org/software/hello/manual/gettext/Plural-forms.html . You only need to enter the expression, for example, if you see Plural-Forms: nplurals=2; plural=n>1; for Brazilian Portuguese, you only need to enter nplurals=2; plural=n>1; in Poedit
  3. Equally important- you need to preserve special modifiers like %d, %s etc. For example, if you see %s in original text, %s needs to be in translation as well- that part is replaced by some other text in software (for example, actual coupon value)
  4. Make sure the locale folder (system/locale/<your_locale>/LC_MESSAGES) is writeable by web-server!
  5. Upload both of your changed files (*.mo and *.po) to LC_MESSAGES folder. Poedit compiles *.mo automatically after you save changes to *.po file.
  6. There are some strings that also need to be translated in JavaScript files:

public/javascripts/campaigns.js
public/javascripts/my_profile.js

Change config files

Since version 3.0 the locale has to be set in Backend->Settings->Localization. The list of available locales is shown.

If you are using version 2.7 or older, change the language code in system/application/config/config.php. Look for line that reads:
$config['locale'] = ‘en’;
In this case, the line must be edited like this:
$config['locale'] = ‘ru_RU’;

Possible problems

  • In case of shared hosting, you may have to wait for some time before server “picks up” new translations. This depends on your server setup and sometimes a web-server restart may be neccesary.
  • For testing purposes, you can enable gettext autoreloading. This feature is a performance hog, but might be handy when updating translations initially. To use auto reloading, add this line to your system/application/config/config_local.php

$config['gettext_autoreload'] = true;

  • If this does not work, please ensure your server has the needed locale installed. For linux users, this means locale should appear in the output of `locale -a`. If unsure, ask your hosting about this
  • Both *.mo and *.po files should be uploaded to webserver, not just *.po.
  • Make sure .PO file you translated is using UTF-8 encoding, otherwise it will not work
  • Missing translation strings in .po file- see Updating translations
Personal tools

Groupon Clone