You can customize localization by adding your custom translation texts in the locale file
and referencing them in a widget template file.
Adding a Custom Title for the Current Window
The Genero Web Client for
JavaScript (GWC-JS) front-end provides a mechanism to internationalize your application interface.
For more details about this mechanism see
Translations for GWC-JS. For example to add a custom title for the current window, perform the following:
- Add a Localization Key
In your
project_dir/customization/customization_project/locales
directory, choose your localization file or create your own one named
xx-YY.json, where "xx-YY" follows the standard localization code used for
languages. For example, to the locale file for French
fr-FR.json, add your
custom keys:
{
"mycusto":{
"window":{
"currentTitle": "Titre de la fenêtre courante"
}
}
}
In
this case the translation key is
mycusto.window.currentTitle
- Reference the Translation Key in a Widget Template file
Reference your custom
translation key with the HTML attribute
data-i18n in the widget template file for
the header bar. For example, in
project_dir/customization/custom_project_dir/js/MyHeaderBarWidget.tpl.html add this within a
<span> element
with default text.
<span class="…" data-i18n="mycusto.window.currentTitle">Currently opened window title</span>
Figure 1. GWC-JS User Interface French Locale
An English browser displays "Currently opened window title", and a French browser displays
"Titre de la fenêtre courante".