Procházet zdrojové kódy

replace lang type with union

Yuki Takei před 3 roky
rodič
revize
824323e518

+ 2 - 1
packages/app/src/interfaces/user.ts

@@ -1,6 +1,7 @@
 import { IAttachment } from './attachment';
 import { Ref } from './common';
 import { HasObjectId } from './has-object-id';
+import { Lang } from './lang';
 
 export type IUser = {
   name: string,
@@ -14,7 +15,7 @@ export type IUser = {
   admin: boolean,
   apiToken?: string,
   isEmailPublished: boolean,
-  lang: string,
+  lang: Lang,
   slackMemberId?: string,
 }
 

+ 4 - 2
packages/app/src/next-i18next.config.ts

@@ -5,11 +5,13 @@ import I18nextChainedBackend from 'i18next-chained-backend';
 import I18NextHttpBackend from 'i18next-http-backend';
 import I18NextLocalStorageBackend from 'i18next-localstorage-backend';
 
+import { AllLang, Lang } from './interfaces/lang';
+
 const isDev = process.env.NODE_ENV === 'development';
 
 export const i18n = {
-  defaultLocale: 'en_US',
-  locales: ['en_US', 'ja_JP', 'zh_CN'],
+  defaultLocale: Lang.en_US,
+  locales: AllLang,
 };
 export const defaultNS = 'translation';
 export const localePath = path.resolve('./public/static/locales');