Console Localization¶
Console is based on an implementation of the Sample Web UI. By modifying the Sample Web UI, we can build a translated Console application.
The Sample Web UI is built on Angular which supports localization for additional languages using i18n. This tutorial will show how Console can be built in a new language, French.
What You'll Need¶
Software on the Development System
What You'll Do¶
The following sections describe how to:
- Create a Translation File
- Update the Sample Web UI Configuration
- Build Console Application
These steps highlight how to build Console in a French translation.
Clone the Sample Web UI and Console¶
- 
If you do not have the Sample Web UI repository, clone the latest version. git clone https://github.com/device-management-toolkit/sample-web-ui.git --branch v3.34.2
- 
If you do not have the Console repository, clone the latest version. git clone https://github.com/device-management-toolkit/console.git
Translate Strings¶
- 
Open the messages.xlffile insample-web-ui/src/locale/.This file contains all of the strings and their locations within the Sample UI. These need to be translated. 
- 
Make a copy of the messages.xlfsource language file.
- 
Rename the copy to messages.fr.xlffor our target French translation.
- 
Translate the file using a text editor or XLIFF editor tool. See the Angular Translation Documentation for more information. 
- 
Save the file. 
Update Sample Web UI Configuration¶
Now that we have a translated .xlf file, we can modify the Sample Web UI configuration to utilize it when building the bundle.
Update angular.json¶
- 
Open the angular.jsonfile in the/sample-web-ui/directory
- 
Add the below i18n:block to theopenamtui:section. Additional locales can be appended for each additional language to support.... "openamtui": { "projectType": "application", "schematics": { "@schematics/angular:component": { "style": "scss" }, "@schematics/angular:application": { "strict": true } }, "root": "", "sourceRoot": "src", "i18n": { "sourceLocale": "en-US", "locales": { "fr": { "translation": "src/locale/messages.fr.xlf", "baseHref": "/" } } }, ...
- 
Add localize:field to thebuild:section.... "build": { "builder": "@angular-devkit/build-angular:browser", "options": { "outputPath": "dist/openamtui", "index": "src/index.html", "main": "src/main.ts", "polyfills": "src/polyfills.ts", "localize": ["fr"], "tsConfig": "tsconfig.app.json", ...
- 
Save the file. 
Build Translated Console¶
Now that the strings are translated and the deployment configurations are updated, we can build and run Console.
- 
Build the Sample Web UI. npm run build-enterprise
- 
Copy the newly generated sample-web-ui/ui/directory.
- 
Paste the directory into the console/internal/app/controller/http/ui/directory.
- 
Build the Console application. go build -o console_windows_x64.exe ./cmd/app/main.gogo build -o console_linux_x64 ./cmd/app/main.go
- 
Run the executable. Example - Console Home Page   Figure 1: Console English Login page