Introduction

OpenVeo translations are grouped by dictionaries (JSON files in i18n directory). Actually the server is capable of returning a dictionary by its name and language. Nothing more. The OpenVeo back end is translated on the client side application (AngularJS).

Dictionaries

Dictionaries are all stored in i18n directory. Dictionary file name is composed of the name of the dictionary followed by the language code:

[DICTIONARY_NAME]-[LANGUAGE_CODE].json

With :

  • [DICTIONARY_NAME] the name of the dictionary
  • [LANGUAGE_CODE] the language code

e.g. my-dictionary-en_ca.json (will contain translations of dictionary "my-dictionary" for Canadian english)
e.g. my-dictionary-fr.json (will contain translations of dictionary "my-dictionary" for French)

If the dictionary must be accessible only by users authenticated to the back end, you must add the prefix : admin-.

e.g. admin-my-dictionary-en_ca.json

Get a public dictionary

From client side, you can request a dictionary using /getDictionary/:dictionary/:code

e.g. /getDictionary/my-dictionary/en_ca

From server side, you can use the core API:

process.api.getCoreApi().getTranslations('my-dictionary', 'en_ca', function(error, translations) {
  console.log(translations);
});

Get a back end dictionary

From client side, you can request a back end dictionary (requiring an authenticated user) using /be/getDictionary/:dictionary/:code

e.g. /be/getDictionary/my-dictionary/en_ca

Nb : Your dictionary file will be admin-my-dictionary-en_ca.json

You can use the back end AngularJS API (module ov.i18n) to help you manipulate dictionaries. See back end AngularJS for more information.

From server side, you can use the core API:

process.api.getCoreApi().getTranslations('admin-my-dictionary', 'en_ca', function(error, translations) {
  console.log(translations);
});