diff --git a/packages/core/src/__mocks__/sign-in-experience.ts b/packages/core/src/__mocks__/sign-in-experience.ts index 0efc501e2..8ec188d14 100644 --- a/packages/core/src/__mocks__/sign-in-experience.ts +++ b/packages/core/src/__mocks__/sign-in-experience.ts @@ -1,7 +1,7 @@ +import { Language } from '@logto/phrases'; import { Branding, BrandingStyle, - Language, LanguageInfo, SignInExperience, SignInMethods, diff --git a/packages/core/src/routes/sign-in-experience.guard.test.ts b/packages/core/src/routes/sign-in-experience.guard.test.ts index 4ab7765ae..2a84a6725 100644 --- a/packages/core/src/routes/sign-in-experience.guard.test.ts +++ b/packages/core/src/routes/sign-in-experience.guard.test.ts @@ -1,9 +1,5 @@ -import { - CreateSignInExperience, - Language, - SignInExperience, - SignInMethodState, -} from '@logto/schemas'; +import { Language } from '@logto/phrases'; +import { CreateSignInExperience, SignInExperience, SignInMethodState } from '@logto/schemas'; import { mockAliyunDmConnectorInstance, diff --git a/packages/phrases/src/index.ts b/packages/phrases/src/index.ts index 1767cd314..1b38b22d9 100644 --- a/packages/phrases/src/index.ts +++ b/packages/phrases/src/index.ts @@ -10,9 +10,14 @@ export type Languages = keyof Resource; export type I18nKey = NormalizeKeyPaths; export type AdminConsoleKey = NormalizeKeyPaths; +export enum Language { + English = 'en', + Chinese = 'zh-CN', +} + const resource: Resource = { - en, - 'zh-CN': zhCN, + [Language.English]: en, + [Language.Chinese]: zhCN, }; export default resource; diff --git a/packages/schemas/src/foundations/jsonb-types.ts b/packages/schemas/src/foundations/jsonb-types.ts index 8b77569c3..3478c0ce6 100644 --- a/packages/schemas/src/foundations/jsonb-types.ts +++ b/packages/schemas/src/foundations/jsonb-types.ts @@ -1,3 +1,4 @@ +import { Language } from '@logto/phrases'; import { z } from 'zod'; /** @@ -119,11 +120,6 @@ export const termsOfUseGuard = z.object({ export type TermsOfUse = z.infer; -export enum Language { - English = 'en', - Chinese = 'zh-cn', -} - export const languageInfoGuard = z.object({ autoDetect: z.boolean(), fallbackLanguage: z.nativeEnum(Language), diff --git a/packages/schemas/src/seeds/sign-in-experience.ts b/packages/schemas/src/seeds/sign-in-experience.ts index b7600f700..bafc8ff37 100644 --- a/packages/schemas/src/seeds/sign-in-experience.ts +++ b/packages/schemas/src/seeds/sign-in-experience.ts @@ -1,5 +1,7 @@ +import { Language } from '@logto/phrases'; + import { CreateSignInExperience } from '../db-entries'; -import { BrandingStyle, Language, SignInMethodState } from '../foundations'; +import { BrandingStyle, SignInMethodState } from '../foundations'; export const defaultSignInExperience: Readonly = { id: 'default',