Internationalization Guide
About
This will allow any piece of static text in the application to be modified dynamically.
Usage
n the UI code, there are three options for converting the text provided into translated text.
- Component:
<translate-i18n key="action.foo">Foo</translate-i18n>
- Directive:
<label for="foo" translate="label.foo">Foo</label>
- Pipe:
{{ action.foo | translate }}
In addition, the application.yml
file is an example of a file where dynamic values from the server, can be populated with an i18n identifier for translation. The json files used to generate the metadata wizards also make use of these identifiers and can be translated. They all use the same messages.properties
files.
Here is an example of the identifers and text found in the messages.properties
files.
action.cancel=Cancel
action.save=Save
action.delete-type=Delete { type }
The action.delete-type=Delete { type }
example shows how dynamic text can be inserted into the translation as well. These values are determined by the application and are populated at runtime based on user interaction. Many of these values can be translated separately.
Conventions
Choosing an identifier
To allow for easier identification of relevant strings the identifiers are provided in the following format
type.kebab-case-text