Convert i18n resource to key type

This commit is contained in:
Hoàng Rio
2018-11-09 13:51:28 +07:00
parent beab9a1be0
commit d47a23269d
22 changed files with 389 additions and 366 deletions

View File

@@ -3,7 +3,20 @@ import i18n from 'i18next';
import { reactI18nextModule } from 'react-i18next';
import { initReactI18n } from 'react-i18next/hooks';
import langDetect from 'i18next-browser-languagedetector';
import viResource from './__locales/vi';
import vi from './__locales/vi';
import en from './__locales/en';
export const languages = [
{
key: 'vi',
name: 'Tiếng Việt',
},
{
key: 'en',
name: 'English',
},
];
i18n
.use(langDetect)
@@ -11,7 +24,8 @@ i18n
.use(reactI18nextModule) // passes i18n down to react-i18next
.init({
resources: {
vi: viResource,
vi,
en,
},
fallbackLng: 'en',
keySeparator: false, // we use content as keys