Internationalization¶
Globalization
(g11n). to extend its reach beyond the confines of a specific region, culture or language.Internationalization
(i18n). The process of designing and building a product so it is indifferent to any specific culture or language.Localization
(l10n). The process of adapting and customizing a product for a specific target audience, as identified by its language and culture. Localization includes translating text as well as ensuring that the UI, text and images are formatted and presented in a way that is acceptable to the target audience.Translation
(t9n). The process of translating all readable text into the language of the target audience. Translation is a key step in the localization process, but it is not the only step.
Translation¶
Since 6.9.9
Resources¶
Platform6
supports translation using properties files stored in a dedicated folder (cf. p6.i18n.folder
)
Translation files are going to be read in a specific order:
- p6_locale_country_variant.properties
- p6_locale__variant.properties
- p6_en__variant.properties
- p6_locale_country.properties
- p6_locale.properties (reserved)
- p6_en_EN.properties
- p6_en.properties (reserved)
- p6.properties (reserved)
First match of a key in those files will stop the search and result is cached.
Note
The files marked as reserved are used internally by Platform6 and can’t be overridden.
You must use the locale_country
instead.
Note
Applications must use the variant to store specific content (i.e. p6_en__AppKey.properties). Only alphanumeric characters are allowed.
Warning
There is currently no automatic process to deploy application translations.
The actual best practice is to use bundled resources and to deploy the translations into the p6.i18n.folder
.
Tip
When a translation file is deployed, you should clear the cache using the dsl i18n
Example
p6.i18n.clearCache()
Interpolation¶
String interpolation could be performed on some cases and will use the freemarker syntax.
Example
${i18n('fee')}
fee
.
The local used to retrieve the correct translation will depend on the context:
- based on the user performing the action
- based on the pipeline variable
- or use the default language
EN
Usages¶
Accessing the translations can be done using dsl or predefined features in the services
DSL¶
- Reset translation cache
p6.i18n.clearChache()
- Get translation
p6.i18n.translate(key)
- Using freemarker
i18n
functionp6.fm.process
- Using xslt
p6:i18n
functionp6.xslt.process
Service¶
All¶
Description
Currently, for all the services, when the description of a service item is retrieved, the localized version,
based on the user preferences is returned. If not applicable, then fallback to EN
.
Now, interpolation of variables is achieved while reading the translations.
If you want to translate the description using the property files you have to set the description this way
<description>
<EN>${i18n('path.to.key')}</EN>
</description>
path.to.key=English description
path.to.key=Description en français
Note
It is not mandatory to migrate to this new syntax, it is just a new feature.
Button¶
When retrieved, Button label
and Button tooltip
are interpolated.
Charts¶
Charts already have a translation mechanism using the internationalization
tab.
Inside the config variables like ${title}
are replaced by the corresponding value inside the translation using FreeMarker.
When retrieved, Config
is interpolated
Forms¶
Forms already have a translation mechanism using the internationalization
tab.
Inside the schema, variables like ${title}
are replaced by the corresponding value inside the translation using FreeMarker.
When retrieved, Schema
, Look & Feel
, Default data
and Internationalization
are interpolated
Transaction¶
CSV
and Excel
files generated using export feature contains headers based on the Viewables.
The headers, based on the viewables description are also interpolated.
Views¶
Viewables¶
It was already possible to translate the column names using the <Description>
node.
Now on the <Type>
node you can add an i18n
attribute to automatically translate the displayed value.
Searchables¶
It was already possible to translate the searchable names using the <Description>
node.
Now you can translate the <Choice>
values.
Transaction detail¶
Transaction view detail is now translated before being passed to the script.