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

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.

Add translations to existing dictionary

By default, openveo core defines several dictionaries, one of these dictionaries is the admin-back-office dictionary. You may want to add translations to this dictionary to avoid requesting 2 dictionaries. For example if we want, in our book plugin, to add the following translations :

i18n/admin-back-office-en.json

{
  "MENU" : {
    "MY_ITEM" : "My menu item"
  }
}

Calling /be/getDictionary/back-office/en will return :

{
  "CORE" : {
    "MENU" : {
      "WEB_SERVICE" : "Web Service",
      "RIGHTS" : "Rights",
      "ROLES" : "Roles",
      "USERS" : "Users",
      "GROUPS" : "Groups",
      "APPLICATIONS" : "Applications",
      "DASHBOARD" : "Dashboard",
      "PROFILES"  : "Profile",
      "LANGUAGE" : "Language",
      "LOGOUT" : "Logout"
    }
    [...]
  },
  "BOOK" : {
    "MENU" : {
      "MY_ITEM" : "My menu item"
    }
  }
}

Nb : You can see that you got both yours and core translations. Not that core translations are wrapped into a "CORE" property while your translations are wrapped into a "BOOK" property.