xref: /openbmc/webui-vue/src/i18n.js (revision 883a0d59)
1import { createI18n } from 'vue-i18n';
2
3import en_us from './locales/en-US.json';
4import ru_ru from './locales/ru-RU.json';
5
6function loadLocaleMessages() {
7  const messages = {
8    'en-US': en_us,
9    'ru-RU': ru_ru,
10  };
11  return messages;
12}
13
14const i18n = createI18n({
15  // Get default locale from local storage
16  locale: window.localStorage.getItem('storedLanguage'),
17  // Locales that don't exist will fallback to English
18  fallbackLocale: 'en-US',
19  // Falling back to fallbackLocale generates two console warnings
20  // Silent fallback suppresses console warnings when using fallback
21  silentFallbackWarn: true,
22  messages: loadLocaleMessages(),
23  globalInjection: false,
24  legacy: false,
25});
26
27export default i18n;
28