Improve i18n resource typing
This commit is contained in:
@@ -33,7 +33,9 @@ export const i18nResources = [
|
|||||||
'vi',
|
'vi',
|
||||||
'zh_Hans',
|
'zh_Hans',
|
||||||
'zh_Hant',
|
'zh_Hant',
|
||||||
];
|
] as const;
|
||||||
|
|
||||||
|
export type I18nResourceCode = (typeof i18nResources)[number];
|
||||||
|
|
||||||
export const i18n = use(initReactI18next)
|
export const i18n = use(initReactI18next)
|
||||||
.use(HttpBackend)
|
.use(HttpBackend)
|
||||||
|
|||||||
@@ -6,9 +6,9 @@
|
|||||||
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
* file, You can obtain one at https://mozilla.org/MPL/2.0/.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export const loadDefaultDayJsLocale = () => import('dayjs/locale/en.js');
|
import { I18nResourceCode } from '@/i18n';
|
||||||
|
|
||||||
export type ISOLanguageCode = string;
|
export const loadDefaultDayJsLocale = () => import('dayjs/locale/en.js');
|
||||||
|
|
||||||
export type ISOLanguage = {
|
export type ISOLanguage = {
|
||||||
name: string;
|
name: string;
|
||||||
@@ -17,7 +17,7 @@ export type ISOLanguage = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// full list: https://github.com/meikidd/iso-639-1/blob/master/src/data.js
|
// full list: https://github.com/meikidd/iso-639-1/blob/master/src/data.js
|
||||||
export const ISOLanguages: Record<ISOLanguageCode, ISOLanguage> = {
|
export const ISOLanguages: { [languageCode in I18nResourceCode]: ISOLanguage } & Record<string, ISOLanguage> = {
|
||||||
// #############################
|
// #############################
|
||||||
// ### ###
|
// ### ###
|
||||||
// ### START: manually added ###
|
// ### START: manually added ###
|
||||||
|
|||||||
Reference in New Issue
Block a user