blob: 8135a409a34af7f3fecdca1adc52fdaf01229356 [file] [log] [blame]
Ed Tanous7d6b44c2024-03-23 14:56:34 -07001import { createI18n } from 'vue-i18n';
Dixsie Wolmerscbcd2132020-01-30 20:58:37 -06002
Ed Tanous7d6b44c2024-03-23 14:56:34 -07003import en_us from './locales/en-US.json';
4import ru_ru from './locales/ru-RU.json';
Dixsie Wolmerscbcd2132020-01-30 20:58:37 -06005
6function loadLocaleMessages() {
Ed Tanous7d6b44c2024-03-23 14:56:34 -07007 const messages = {
8 'en-US': en_us,
9 'ru-RU': ru_ru,
10 };
Dixsie Wolmerscbcd2132020-01-30 20:58:37 -060011 return messages;
12}
13
Ed Tanous7d6b44c2024-03-23 14:56:34 -070014const i18n = createI18n({
Dixsie Wolmersc85395f2020-02-26 13:22:12 -060015 // Get default locale from local storage
Sukanya Pandey5ee04ef2020-03-19 10:23:23 +053016 locale: window.localStorage.getItem('storedLanguage'),
Dixsie Wolmersc85395f2020-02-26 13:22:12 -060017 // 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,
Derick Montague602e98a2020-10-21 16:20:00 -050022 messages: loadLocaleMessages(),
Ed Tanous7d6b44c2024-03-23 14:56:34 -070023 globalInjection: false,
24 legacy: true,
Dixsie Wolmerscbcd2132020-01-30 20:58:37 -060025});
Ed Tanous7d6b44c2024-03-23 14:56:34 -070026
27export default i18n;