Skip to content

Translations

Lime CRM is a multilingual program. To support several languages, the source code or markup in Lime CRM never contains any translated strings, instead it contains keys. These keys are translated into the language the user running Lime CRM has chosen.

Providing custom translations

The translations_module makes it possible to add custom translations to a package or to reuse existing translations in a package.

Generating the translation_module

To add the translations to your package, change directory to your package directory and run the following command:

lime-project generate translation-module
This is going to create a new folder translations in package directory, that includes po-files for English and Swedish. Each file will have the following content:

msgid "custom.translation" 
msgstr "This is the translation"
To add an additional language just create a new po-file with the language abbreviation as file name (e.g. da.po). To add a new translation, add two new lines to each file. The first line with the key (msgid), and the second one with the translation (the msgstr) for your translation. After that you only need to restart the webserver and then the translation shall be available in the platform.

Example of a en.po-file with several translations:

msgid "custom.title" 
msgstr "My big deal"
msgid "custom.responsible" 
msgstr "sales rep"
msgid "custom.comment" 
msgstr "comment"

Webclient usage

  • To see all translations go to <WEBCLIENT-DOMAIN>/webclient/translations.
  • When your package is loaded by the webclient, it checks for translations, registers them and adds your packages lib-name as prefix. So you don't have to worry about overriding existing keys by accident.
  • While you define translation keys in your package po-file without a prefix, keep in mind that you have to use <LIB-NAME>.custom.translation instead of custom.translation in your code
  • The language selection for packages works the same way as for the webclient. If your package doesn't provide a translation for the requested language, the translation key is going to be shown.

Using the translation service in the webclient

The platform object injected to a web component in Lime CRM contains a translation service. Out of the box you can use this service to translate any key that exists in Lime CRM.

Back to top