OpenVeo server API for plugins

API Docs for: 3.0.0
Show:

core-i18n

Defined in: lib/i18n.js:3
Module: core-i18n

Summary

Provides functions to help translates the application. Translations are grouped by dictionaries.

Item Index

Methods

Methods

getTranslations

Defined in lib/i18n.js:18

Syntax

getTranslations

(
  • dictionary
  • code
  • callback
)
async

Summary

Gets a dictionary of translations by its name and language. Search is made on i18n directory and all plugin's i18n directories. If the same dictionary name is found twice (same file name in different i18n directories), dictionaries are merged.

Parameters:

  • dictionary String

    The name of the dictionary, this is the name of the dictionary file without extension

  • code String

    The language country code (e.g. en-US)

  • callback Function

    Function to call when its done

    • Error An error if something went wrong
    • Object A JavaScript object containing all translations

Example:

var i18n = require('@openveo/api').i18n;
i18n.getTranslations('login', 'fr-FR', function(error, translations){
  console.log(translations);
});
var i18n = require('@openveo/api').i18n;
i18n.getTranslations("back-office", "en", function(error, translations){
  console.log(translations);
});