Internationalization¶
In the file <package>.mk
, define the supported languages with (default):
LANGUAGES ?= en fr de
In the file vars.yaml
, define the available and default locales:
vars:
...
default_locale_name: fr
available_locale_names: [en, fr, de]
In the file language_mapping
, define any desired locale variants, for example:
fr=fr-ch
Build your application.
The files to translate are:
geoportal/<package>_geoportal/locale/<lang>/LC_MESSAGES/<package>-client.po
for the ngeo client
Note
All the #, fuzzy
strings should be verified and the line should be removed
(if the line is not removed, the localisation will not be used).
To update your po
files, you should proceed as follows.
docker-compose exec tools update-po $(id --user) $(id --group) \
<lang_1> [<lang_2> [...]]
Note
You should run this command when you change something in the following:
layer in mapfile (new or modified)
layer in administration (new or modified)
raster layer in the vars file (new or modified)
print template
full-text search
application (JavaScript and HTML files)
layer enumeration
some metadata as disclaimer
editable layer (database structure, data or enumerations)
Note
In mapfiles, attributes added by mapserver substitution will not be collected for translation.
Collect custom strings¶
If the standard system can not collect some strings, you can add them manually in one of your JavaScript application controllers:
/** @type {angular.gettext.gettextCatalog} */
const gettextCatalog = $injector.get('gettextCatalog');
gettextCatalog.getString('My previously not collected string');