Localization: Adding a Custom Language Pack
The add_lang(lang_id, lang_obj)
method allows adding a new or customized language pack.
Parameters:
lang_id
: a string value that can be subsequently used aslang
parameter for theopen()
method;lang_obj
: an object that includes identifiers of translation strings as keys and translation strings themselves as values.
A list of language identifiers:
lang_id | Language |
---|---|
en | English |
es | Spanish |
pt-br* | Portuguese (Brazilian) |
kz | Kazakh |
*Formerly pt
, changed in 1.3.1.
An example of usage:
OzLiveness.add_lang('en', enTranslation)
, where enTranslation
is a JSON object.
A list of all language identifiers:
The keys oz_action_*_go
refer to the appropriate gestures. oz_tutorial_camera_*
– to the hints on how to enable camera in different browsers. Others refer to the hints for any gesture, info messages, or errors.
If your language pack doesn't include a key, the translation for this key won't be shown. It also applies to the new keys that appear in updated versions: you need to add translations to all new keys for the strings to be shown.
Last updated