cloudux-l10n

1.1.1 • Public • Published

cloudux-l10n

Package to providing localization for the Avid® MediaCentral UX static plugins.

Getting the localization files

To be able to get the localization files you have to request them through our API. Localization file will be fetched by using our internal mechanism that depends on the current runtime user locale.

Example

import localizationData from 'path/to/your/folder/lang.l10n.json'

Here is the lang.10n.json is the template file name, which will be replaced by the current language in the runtime. For instance, if current locale will be the 'de' name of the required file will be lang.de.json_

To be able to use this API you have to provide the localization files at your project. This is name convention in the name of this files that resolves by API. To be able to obtain the file according to the current runtime localization you should require some-file-name.l10n.json file where In case if German is being active locale, file name request will be resolved to some-string.de.json at runtime level to the name of the current locale. Localization has names according to ISO_639-1

Example of the file system structure

    static-plugin-folder/
    ├── src
    │   ├── index.js
    │   ├── l10n
    │   │   ├── lang.de.json
    │   │   ├── lang.fr.json
    │   │   └── lang.en.json
    │   └── views
    │       ├── settings-view
    │       │   ├── index.js

Localization file structure

Localization file has the flat json object structure. Nesting object is currently unsupported. Example of the lang.en.json:

{
 'hello-msg': 'Hello World'
}

the same file in different language will have the same key6 but localized value. For instance, in Deutch lang.de.json will be

{
 'hello-msg': 'Hallo Welt'
}

Require the localization file

In the above example we placed the three localization files in the folder named l10n. This localization should be required as an external module. For instance, by using AMD module pattern Or, if you are using the webpack, you have to add the path to localization file as an external dependency. See example below.

  //@file "static-plugin-folder/src/views/settings-view/index.js";
  const l10nData = require('../../l10n/lang.l10n.json'); // path relative to this file
  // If current locale is === "de" will be required file named lang.de.json
  // l10nData = { 'submit': 'Einreichen' };
  const localize = l10n.getLocalization(l10nData);
 

Parametrized labels

If you need parametrized labels, add parameters using {}: In your localization file:

{
   "copy-folder-part-of-items-error-message": "{​​​​​​0}​​​​​​ of {​​​​​​1}​​​​​​ items cannot be copied to the destination folder."
}

Usage:

localize('copy-folder-part-of-items-error-message', errorItemsCount, copyItemsCount)

You can check it on our examples on Avid-Technology Github

Readme

Keywords

Package Sidebar

Install

npm i cloudux-l10n

Weekly Downloads

36

Version

1.1.1

License

SEE LICENSE IN EULA.md

Unpacked Size

20.4 kB

Total Files

6

Last publish

Collaborators

  • wbauer
  • joeapearson
  • enterit
  • anna.kryzhko
  • anna.vaskovska
  • yvadim
  • diana_chaikovska
  • vladyslav.kurakov
  • michal.oleszczuk.avid