Add a new language
Admin panel
Copy
admin/src/locales/en/to a new folder named with the language code, for exampleadmin/src/locales/fr/.Add the language to the
MessageLanguageenum inadmin/src/locales/messages.ts:tsexport enum MessageLanguage { En = 'en', Ru = 'ru', Hy = 'hy', Fr = 'fr', // add here }Add an entry for the new language to the initial object of
buildMessagesinmessages.ts:tsconst result: Record<MessageLanguage, LanguageMessages> = { [MessageLanguage.En]: {}, [MessageLanguage.Ru]: {}, [MessageLanguage.Hy]: {}, [MessageLanguage.Fr]: {}, // add here }Add the language code to
SUPPORTED_LOCALESinadmin/src/i18n.ts:tsexport const SUPPORTED_LOCALES = [ MessageLanguage.En, MessageLanguage.Hy, MessageLanguage.Ru, MessageLanguage.Fr, // add here ] as constAdd the code to
LANGUAGESinadmin/scripts/lib/i18nCheck.ts:tsexport const LANGUAGES = ['en', 'ru', 'hy', 'fr'] as constIf the language needs a plural rule, add it to
admin/src/i18n.tsfollowing therussianPluralfunction already there, and register it underpluralRules.
Client portal
Copy
client/locales/en/to a new folder named with the language code, for exampleclient/locales/fr/.Add the language to the
AppLocaleenum inclient/types/applocale.ts:tsexport enum AppLocale { En = 'en', Ru = 'ru', Hy = 'hy', Fr = 'fr', // add here }APP_LOCALESandDEFAULT_APP_LOCALEinclient/constants/appLocales.tsare derived from the enum automatically.Add an entry to the
i18n.localeslist inclient/nuxt.config.ts:tslocales: [ { code: 'en', name: 'English', language: 'en-US' }, { code: 'ru', name: 'Русский', language: 'ru-RU' }, { code: 'hy', name: 'Հայերեն', language: 'hy-AM' }, { code: 'fr', name: 'Français', language: 'fr-FR' }, // add here ],
API
Add the language files next to the existing ones:
backend/src/Innovayse.Hostpanel.Application/Resources/ErrorMessages.fr.resxbackend/src/Innovayse.Hostpanel.Application/Resources/ApplicationValidationMessages.fr.resxbackend/src/Shared/Resources/ValidationMessages.fr.resx
Add the code to
SupportedLanguages.Allinbackend/src/Shared/Constants/SupportedLanguages.cs:csharppublic static readonly HashSet<string> All = ["en", "ru", "hy", "fr"];Add the code to
LocaleOptions.SupportedLocalesinbackend/src/Innovayse.Hostpanel.Application/Common/Settings/LocaleOptions.cs:csharppublic static readonly IReadOnlyList<string> SupportedLocales = ["en", "ru", "hy", "fr"];The backend list above covers the core error and validation messages. The following places also need updating for a complete language addition:
Required — the language will not work without these:
SupportedLanguages.AllandLocaleOptions.SupportedLocalesas shown above.
Client portal extras (required for a fully translated storefront):
client/composables/useSeo.ts— add an entry toogLocaleMapso Open Graph and hreflang tags use the correct locale code, e.g.[AppLocale.Fr]: 'fr_FR'.client/server/utils/clientMenuLabels.ts— add a new[AppLocale.Fr]: { ... }block toCLIENT_MENU_MESSAGESwith the translated labels for the SSO widget menu.
Admin panel extras (required):
admin/src/lib/constants.ts— add an entry to theLANGUAGE_OPTIONSlist for the new language so it appears in the language selectors of the client and user forms. Its label reads a new key,clients.clientForm.french(use the name of your language), which you add to every language file ofadmin/src/locales/<lang>/clients.json, next toenglish,russianandarmenian.admin/src/lib/storefrontTranslations.ts— add the new locale toSTOREFRONT_LOCALESand add a[MessageLanguage.Fr]: blank()entry toblankTranslationsso storefront content forms carry a tab for the new language.admin/src/composables/useStorefrontLocaleTabs.ts— add a tab entry for the new locale to thetabscomputed array.
Settings with a language suffix (optional):
The contact address, the working hours, the live chat token and the company story of the About page (
portal.about.text) each have one value per language, for exampleportal.contact.address.ruandportal.chat.website_token.hy. A language without its own value uses the default one, so a new language works without any of this. Add them only if the operator needs a different address, hours, chat token or company story for the new language. Then every one of these places needs the new key, with the same suffix:backend/src/Innovayse.Hostpanel.Domain/Settings/PortalSettingKeys.cs— the constants, for exampleContactAddressFr = "portal.contact.address.fr", and their entries in the list of defaults, with an empty default and a description such as "Office address for French visitors. Empty uses the default address."admin/src/types/setting.ts— theSettingKeyentries (ContactAddressFr,ContactHoursFr,ChatWebsiteTokenFr) and theirSettingEnventries, for exampleCONTACT_ADDRESS_FR. The company story has no field in the admin panel, so it needs nothing here.client/constants/portalSettingKey.ts— the same keys in thePortalSettingKeyenum.client/constants/publicPortalSettingKeys.ts— the keys in the allow-lists, so the storefront endpoint exposes them: the contact keys, the chat token key and the company story key.client/nuxt.config.ts— the runtime config entriesportalContactAddressFr,portalContactHoursFr,portalChatWebsiteTokenFrandportalAboutTextFr, each read fromNUXT_PUBLIC_PORTAL_..._FR. They are the values a deployment sets in the environment.client/composables/useContactDetails.ts(address),client/composables/useContactHours.ts(hours),client/composables/useAboutText.ts(company story) andclient/composables/useLocalizedSetting.ts— a branch for the new locale, so the right value is read.client/plugins/live-chat.ts— the token branch, andlanguageOffor the language name the chat widget shows.admin/src/components/settings/StorefrontContentCard.vue(address and hours fields) andadmin/src/components/settings/TrackingChatCard.vue(token field) — one field for each new key.- The admin locale files — the labels of those fields:
settings.storefrontContent.contactAddressFr,settings.storefrontContent.contactHoursFr(each withlabelandhint) andsettings.trackingChat.chat.tokenFr, in every language ofadmin/src/locales/<lang>/settings.json.
The public demo has its own sample values in
DemoPortalSettingsSeeder.cs. Add the new language there only if the demo should show it.
Email templates
Add a version of each email template in the new language in the admin panel.
Check it
Run all the checks from the Translating Hostpanel page. In addition:
- The new language appears in the language switcher in both the admin panel and the client portal.
- Sending
X-Language: fron a request returns translated error messages.
Before opening the pull request
Do not switch the language on until all texts are translated. Open the pull request against develop.