How to Add a New Language to the Central Server or Security Server UI?
Support for multiple languages in the Central Server and Security Server UIs is available starting from version 7.6.0
This guide provides a step-by-step approach for adding a new language to central-server, security-server, and shared-ui components. It covers setting up translation files, configuring available languages, and managing shared language messages.
Step 1: Add Translation Files (Using ISO 639-1 Language Codes)
File Naming
Use the ISO 639-1 two-letter code (e.g.,
fr.jsonfor French).
File Locations
Place app-specific messages in:
src/central-server/admin-service/ui/src/locales/fr.jsonforcentral-serversrc/security-server/admin-service/ui/src/locales/fr.jsonforsecurity-serversrc/shared-ui/src/locales/fr.jsonfor shared messages inshared-ui
Step 2: Configure Available Languages and Shared Language Messages
Update the following files:
src/security-server/admin-service/ui/src/plugins/i18n.tssrc/central-server/admin-service/ui/src/plugins/i18n.ts
Add available languages
// Define the available languages for the application
export const availableLanguages = ['en','fr']; // includes existing and new languageLanguage selection menu will display available languages in same order as listed in availableLanguages
Updating localizations from third-party libraries
Some translations comes from external libraries:
@vee-validate/i18nhas default error messages for form field validationVuetifyhas default messages for UI components.
Detailed list of supported languages can be found here: Vuetify list and @vee-validate/i18n list
It is possible to add missing translations for not supported languages or change existing ones by updating locale files under:
src/shared-ui/src/localessrc/security-server/admin-service/ui/src/localessrc/central-server/admin-service/ui/src/locales
Few examples:
To change validation message for
urlvalidation rule (source link) which has key:messages.urlupdate one of X-Road locale JSON file by updating/adding this to it:{ "validation": { messages: { "url": "Badly formated URL" } } }
It is important to add translations as part of validation object
Similar procedure can be used to update Vuetify’s built-in translations, for example to change text in empty table (API link) which has key:
$vuetify.noDataText{ "$vuetify": { "noDataText": "No data here" } }
Summary of changes
Add the new language translation files to the specified directories.
Configure available languages in the
central-serverand/orsecurity-serveri18nfiles.
Following these steps will successfully integrate the new language across components.