Convert i18n resource to key type
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user