The texts have been written in US English. If this is your primary language, and you do not wish to offer any other language to your users, you don't have to do anything.
However, if you want to use Spanish in your application, you must enable it in the angular.json
file.
If you created your project with aoc-cli
, your project will already be prepared for localization. That is, you will not need to run ng add @angular/localize
.
Otherwise, the official guide on Angular Internationalization is quite comprehensive.
"i18n": {
"sourceLocale": "es-x-source",
"locales": {
"es": {
"translation": "node_modules/@atlantis-of-code/aoc-client/i18n/aoc-client-EN_ES.xlf"
}
}
With this configuration, upon completing the build, you will have the Spanish compilation result in the /dist/es
directory.
The language files (.xlf) are distributed with the @atlantis-of-code/aoc-client
package and can be found in the node_modules/@atlantis-of-code/aoc-client/i18n
directory.
If you want to add more translations that are not from the framework but from your application, define the locales as an array:
"i18n": {
"sourceLocale": "en",
"locales": {
"es": [
"node_modules/@atlantis-of-code/aoc-client/i18n/aoc-client-EN_ES.xlf",
"src/locales/messages.es.xlf"
]
}
}
This way, they will be merged when you compile your application.
Finally, in the options of each build, you can specify all the locales that should be compiled:
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"outputPath": "dist/app-client",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "tsconfig.app.json",
"localize": false, // ["es"] // ["en"] // ... // true
"inlineStyleLanguage": "scss",
With the localize
value set to false
, it would be used in English only.
To localize the model names so they appear correctly in the user interface, set the boolean parameter localize
to true
in the aoc-entities-config.json
file, and then regenerate the models using aoc-cli g e
.
Please note, browse Issues and Discussions in Github for more information