Skip to content

Interface language files

Eliran Wong edited this page Feb 22, 2021 · 9 revisions

Notes

Language interface files are located in the lang folder. They are in the pattern language_*.py.

UBA currently uses IBM Watson for translation services. For list of supported languages, see here.

Create new language interface file

  1. Run: python -m util.LanguageUtil createNewLanguageFile <2 letter language code>

This will take several minutes to create the language file.

Example to create Greek language file:

python -m util.LanguageUtil createNewLanguageFile "el"

  1. Edit the generated language file and manually fix all errors.

  2. Modify Languages.py to add the translation

Add entry to code

Example: "Greek Νέα Ελληνικά": "el",

Verify translation file

Compare English and Greek files:

python -m util.LanguageUtil compareLanguageFiles "en_US" "el"

Add a new text string to all files

python -m util.LanguageUtil addLanguageStringToAllFiles "textKey" "English text"

This will add "textKey" to all the language files with the translation of "English text".

Update an existing text string to all files

python -m util.LanguageUtil updateLanguageStringToAllFiles "textKey" "English text"

This will update "textKey" to all the language files with the translation of "English text".

Print the names of all the languages UBA supports

python -m util.LanguageUtil printNamesSupportedLanguages

Print the codes of all the languages UBA supports

python -m util.LanguageUtil printCodesSupportedLanguages

Validate all language files have the same number of keys

python -m util.LanguageUtil validateLanguageFileSizes

Update a language file if it has missing keys

Update the Greek language file:

python -m util.LanguageUtil updateLanguageFile "el"

Clone this wiki locally