The module's text strings are written in English, but you might want French, Spanish or Polish shop owners to use your module too. You therefore have to translate those strings into those languages, both the front - office and the back -offices office strings. Ideally, you should translate your module in all the languages that are installed on your shop. This could be a tedious task, but Smarty and PrestaShop's own translation tool make it far easier.
- Go to the "Translations" page under the "Localization" menu,
- In the "Modify translations" drop-down menu, choose "Module Installed modules translations",
- Click the flag of the country of which Choose the language you want to translate the module into. The destination language must already be installed to enable translation in it.
- Click the "Modify" button.
The page that loads displays all the strings for all the currently-installed modules. Modules that have all their strings already translated have their fieldset closed, whereas if at least one string is missing in a module's translation, its fieldset is expanded.
In order to translate your module's strings (the ones that were "marked" using the
l() method), simply find your module in the list (use the browser's in-page search), and fill the empty fields.
Once all strings for your module are correctly translated, click on either the "Update translationSave and stay" button or the "Save" button at the topbottom of your list of strings.
PrestaShop then saves the translations in a new file, named using the
languageCode.php format (for instance,
/mymodule/fr.php). The translation file looks like so:
Now that we have a French translation, we can click on the French flag in the front - office, and get the expected result: the module's strings are now in French.
They are also translated in French when the back - office is in French.