# Conflicts: # app/javascript/dashboard/i18n/index.js # app/javascript/dashboard/i18n/locale/am/index.js # app/javascript/dashboard/i18n/locale/ar/index.js # app/javascript/dashboard/i18n/locale/az/index.js # app/javascript/dashboard/i18n/locale/bg/index.js # app/javascript/dashboard/i18n/locale/ca/index.js # app/javascript/dashboard/i18n/locale/cs/index.js # app/javascript/dashboard/i18n/locale/da/index.js # app/javascript/dashboard/i18n/locale/de/index.js # app/javascript/dashboard/i18n/locale/el/index.js # app/javascript/dashboard/i18n/locale/en/index.js # app/javascript/dashboard/i18n/locale/es/index.js # app/javascript/dashboard/i18n/locale/fa/index.js # app/javascript/dashboard/i18n/locale/fi/index.js # app/javascript/dashboard/i18n/locale/fr/index.js # app/javascript/dashboard/i18n/locale/he/index.js # app/javascript/dashboard/i18n/locale/hi/index.js # app/javascript/dashboard/i18n/locale/hr/index.js # app/javascript/dashboard/i18n/locale/hu/index.js # app/javascript/dashboard/i18n/locale/hy/index.js # app/javascript/dashboard/i18n/locale/id/index.js # app/javascript/dashboard/i18n/locale/is/index.js # app/javascript/dashboard/i18n/locale/it/index.js # app/javascript/dashboard/i18n/locale/ja/index.js # app/javascript/dashboard/i18n/locale/ka/index.js # app/javascript/dashboard/i18n/locale/ko/index.js # app/javascript/dashboard/i18n/locale/lt/index.js # app/javascript/dashboard/i18n/locale/lv/index.js # app/javascript/dashboard/i18n/locale/ml/index.js # app/javascript/dashboard/i18n/locale/ms/index.js # app/javascript/dashboard/i18n/locale/ne/index.js # app/javascript/dashboard/i18n/locale/nl/index.js # app/javascript/dashboard/i18n/locale/no/index.js # app/javascript/dashboard/i18n/locale/pl/index.js # app/javascript/dashboard/i18n/locale/pt/index.js # app/javascript/dashboard/i18n/locale/pt_BR/index.js # app/javascript/dashboard/i18n/locale/ro/index.js # app/javascript/dashboard/i18n/locale/ru/index.js # app/javascript/dashboard/i18n/locale/sh/index.js # app/javascript/dashboard/i18n/locale/sk/index.js # app/javascript/dashboard/i18n/locale/sl/index.js # app/javascript/dashboard/i18n/locale/sq/index.js # app/javascript/dashboard/i18n/locale/sr/index.js # app/javascript/dashboard/i18n/locale/sv/index.js # app/javascript/dashboard/i18n/locale/ta/index.js # app/javascript/dashboard/i18n/locale/th/index.js # app/javascript/dashboard/i18n/locale/tl/index.js # app/javascript/dashboard/i18n/locale/tr/index.js # app/javascript/dashboard/i18n/locale/uk/index.js # app/javascript/dashboard/i18n/locale/ur/index.js # app/javascript/dashboard/i18n/locale/ur_IN/index.js # app/javascript/dashboard/i18n/locale/vi/index.js # app/javascript/dashboard/i18n/locale/zh_CN/index.js # app/javascript/dashboard/i18n/locale/zh_TW/index.js
141 lines
2.2 KiB
JavaScript
141 lines
2.2 KiB
JavaScript
// Keep bundled dashboard locales explicit so adding a language stays deliberate.
|
|
export const SUPPORTED_DASHBOARD_LOCALES = Object.freeze([
|
|
'am',
|
|
'ar',
|
|
'az',
|
|
'bg',
|
|
'bn',
|
|
'ca',
|
|
'cs',
|
|
'da',
|
|
'de',
|
|
'el',
|
|
'en',
|
|
'es',
|
|
'et',
|
|
'fa',
|
|
'fi',
|
|
'fr',
|
|
'he',
|
|
'hi',
|
|
'hr',
|
|
'hu',
|
|
'hy',
|
|
'id',
|
|
'is',
|
|
'it',
|
|
'ja',
|
|
'ka',
|
|
'ko',
|
|
'lt',
|
|
'lv',
|
|
'ml',
|
|
'ms',
|
|
'ne',
|
|
'nl',
|
|
'no',
|
|
'pl',
|
|
'pt',
|
|
'pt_BR',
|
|
'ro',
|
|
'ru',
|
|
'sh',
|
|
'sk',
|
|
'sl',
|
|
'sq',
|
|
'sr',
|
|
'sv',
|
|
'ta',
|
|
'th',
|
|
'tl',
|
|
'tr',
|
|
'uk',
|
|
'ur',
|
|
'ur_IN',
|
|
'vi',
|
|
'zh',
|
|
'zh_CN',
|
|
'zh_TW',
|
|
]);
|
|
|
|
export const LOCALE_MODULES = Object.freeze([
|
|
'advancedFilters',
|
|
'agentBots',
|
|
'agentMgmt',
|
|
'attributesMgmt',
|
|
'auditLogs',
|
|
'automation',
|
|
'bulkActions',
|
|
'campaign',
|
|
'cannedMgmt',
|
|
'chatlist',
|
|
'companies',
|
|
'components',
|
|
'contact',
|
|
'contactFilters',
|
|
'contentTemplates',
|
|
'conversation',
|
|
'csatMgmt',
|
|
'customRole',
|
|
'datePicker',
|
|
'emoji',
|
|
'general',
|
|
'generalSettings',
|
|
'helpCenter',
|
|
'inbox',
|
|
'inboxMgmt',
|
|
'integrationApps',
|
|
'integrations',
|
|
'labelsMgmt',
|
|
'login',
|
|
'macros',
|
|
'mfa',
|
|
'onboarding',
|
|
'report',
|
|
'resetPassword',
|
|
'search',
|
|
'sessionLimit',
|
|
'setNewPassword',
|
|
'settings',
|
|
'signup',
|
|
'sla',
|
|
'snooze',
|
|
'teamsSettings',
|
|
'webhooks',
|
|
'whatsappTemplates',
|
|
'yearInReview',
|
|
]);
|
|
|
|
const localeFiles = import.meta.glob('./locale/*/*.json', {
|
|
eager: true,
|
|
import: 'default',
|
|
});
|
|
|
|
const allowedLocales = new Set(SUPPORTED_DASHBOARD_LOCALES);
|
|
const allowedModules = new Set(LOCALE_MODULES);
|
|
|
|
const messages = Object.fromEntries(
|
|
SUPPORTED_DASHBOARD_LOCALES.map(locale => [locale, {}])
|
|
);
|
|
|
|
Object.entries(localeFiles)
|
|
// Keep merges deterministic if two files ever define the same top-level key.
|
|
.sort(([leftPath], [rightPath]) => leftPath.localeCompare(rightPath))
|
|
.forEach(([filePath, translations]) => {
|
|
const match = filePath.match(/^\.\/locale\/([^/]+)\/([^/]+)\.json$/);
|
|
|
|
if (!match) {
|
|
return;
|
|
}
|
|
|
|
const [, locale, moduleName] = match;
|
|
|
|
if (!allowedLocales.has(locale) || !allowedModules.has(moduleName)) {
|
|
return;
|
|
}
|
|
|
|
Object.assign(messages[locale], translations);
|
|
});
|
|
|
|
export default messages;
|