Translation and I18N
To allow your application to be translated an Internationalization is integrated in the App framework.
Defining the phrases
Language files need to be located in the src/locales
folder with at least a en-US
or en
locale.
Each phrase is associated to a unique id which is used to retrieve it in the application:
hello_name: "Hello, {{name}}!"
You can organise phrases into structures.
welcome:
back: "Welcome back"
again: "Hello again"
When you do this, you refer to the phrase by the full ID, using dots to denote hierarchy, for example
<Phrase id="welcome.again" />
Using the phrases
To use a phrase in your code, use the i18n helper available from dpapp
like this:
<p>{dpapp.i18n.t("hello_name", { name: "John" )}</p>