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.json
for French).
File Locations
Place app-specific messages in:
src/central-server/admin-service/ui/src/locales/fr.json
forcentral-server
src/security-server/admin-service/ui/src/locales/fr.json
forsecurity-server
src/shared-ui/src/locales/fr.json
for 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.ts
src/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 language
Language 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/i18n
has default error messages for form field validationVuetify
has 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/locales
src/security-server/admin-service/ui/src/locales
src/central-server/admin-service/ui/src/locales
Few examples:
To change validation message for
url
validation rule (source link) which has key:messages.url
update 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-server
and/orsecurity-server
i18n
files.
Following these steps will successfully integrate the new language across components.