mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
refactor: remove deprecated fixedLanguage
property from LanguageInfo
(#2111)
This commit is contained in:
parent
44772ba2e1
commit
01fdc4ba11
8 changed files with 1 additions and 19 deletions
|
@ -28,7 +28,6 @@ export const mockSignInExperience: SignInExperience = {
|
||||||
languageInfo: {
|
languageInfo: {
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage: 'en',
|
fallbackLanguage: 'en',
|
||||||
fixedLanguage: 'zh-CN',
|
|
||||||
},
|
},
|
||||||
signInMethods: {
|
signInMethods: {
|
||||||
username: SignInMethodState.Primary,
|
username: SignInMethodState.Primary,
|
||||||
|
@ -60,7 +59,6 @@ export const mockTermsOfUse: TermsOfUse = {
|
||||||
export const mockLanguageInfo: LanguageInfo = {
|
export const mockLanguageInfo: LanguageInfo = {
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage: 'en',
|
fallbackLanguage: 'en',
|
||||||
fixedLanguage: 'zh-CN',
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const mockSignInMethods: SignInMethods = {
|
export const mockSignInMethods: SignInMethods = {
|
||||||
|
|
|
@ -78,7 +78,6 @@ describe('validate language info', () => {
|
||||||
await validateLanguageInfo({
|
await validateLanguageInfo({
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage: 'zh-CN',
|
fallbackLanguage: 'zh-CN',
|
||||||
fixedLanguage: 'en',
|
|
||||||
});
|
});
|
||||||
expect(findAllCustomLanguageTags).toBeCalledTimes(1);
|
expect(findAllCustomLanguageTags).toBeCalledTimes(1);
|
||||||
});
|
});
|
||||||
|
@ -89,7 +88,6 @@ describe('validate language info', () => {
|
||||||
validateLanguageInfo({
|
validateLanguageInfo({
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage: builtInSupportedLanguage,
|
fallbackLanguage: builtInSupportedLanguage,
|
||||||
fixedLanguage: 'en',
|
|
||||||
})
|
})
|
||||||
).resolves.not.toThrow();
|
).resolves.not.toThrow();
|
||||||
expect(findAllCustomLanguageTags).toBeCalledTimes(1);
|
expect(findAllCustomLanguageTags).toBeCalledTimes(1);
|
||||||
|
@ -103,7 +101,6 @@ describe('validate language info', () => {
|
||||||
validateLanguageInfo({
|
validateLanguageInfo({
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage: customOnlySupportedLanguage,
|
fallbackLanguage: customOnlySupportedLanguage,
|
||||||
fixedLanguage: 'en',
|
|
||||||
})
|
})
|
||||||
).resolves.not.toThrow();
|
).resolves.not.toThrow();
|
||||||
expect(findAllCustomLanguageTags).toBeCalledTimes(1);
|
expect(findAllCustomLanguageTags).toBeCalledTimes(1);
|
||||||
|
@ -117,7 +114,6 @@ describe('validate language info', () => {
|
||||||
validateLanguageInfo({
|
validateLanguageInfo({
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage: unsupportedLanguage,
|
fallbackLanguage: unsupportedLanguage,
|
||||||
fixedLanguage: 'en',
|
|
||||||
})
|
})
|
||||||
).rejects.toMatchError(
|
).rejects.toMatchError(
|
||||||
new RequestError({
|
new RequestError({
|
||||||
|
|
|
@ -57,7 +57,6 @@ const findDefaultSignInExperience = jest.fn(
|
||||||
languageInfo: {
|
languageInfo: {
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage: mockFallbackLanguage,
|
fallbackLanguage: mockFallbackLanguage,
|
||||||
fixedLanguage: mockFallbackLanguage,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
|
@ -27,7 +27,6 @@ const findDefaultSignInExperience = jest.fn(async () => ({
|
||||||
languageInfo: {
|
languageInfo: {
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage,
|
fallbackLanguage,
|
||||||
fixedLanguage: fallbackLanguage,
|
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -60,7 +59,6 @@ describe('when auto-detect is not enabled', () => {
|
||||||
languageInfo: {
|
languageInfo: {
|
||||||
autoDetect: false,
|
autoDetect: false,
|
||||||
fallbackLanguage: unsupportedLanguageX,
|
fallbackLanguage: unsupportedLanguageX,
|
||||||
fixedLanguage: unsupportedLanguageX,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const response = await phraseRequest
|
const response = await phraseRequest
|
||||||
|
@ -76,7 +74,6 @@ describe('when auto-detect is not enabled', () => {
|
||||||
languageInfo: {
|
languageInfo: {
|
||||||
autoDetect: false,
|
autoDetect: false,
|
||||||
fallbackLanguage,
|
fallbackLanguage,
|
||||||
fixedLanguage: fallbackLanguage,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -102,7 +99,6 @@ describe('when auto-detect is enabled', () => {
|
||||||
languageInfo: {
|
languageInfo: {
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage: unsupportedLanguageX,
|
fallbackLanguage: unsupportedLanguageX,
|
||||||
fixedLanguage: unsupportedLanguageX,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
const response = await phraseRequest
|
const response = await phraseRequest
|
||||||
|
@ -118,7 +114,6 @@ describe('when auto-detect is enabled', () => {
|
||||||
languageInfo: {
|
languageInfo: {
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage,
|
fallbackLanguage,
|
||||||
fixedLanguage: fallbackLanguage,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -29,7 +29,6 @@ const findDefaultSignInExperience = jest.fn(
|
||||||
languageInfo: {
|
languageInfo: {
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage: customizedLanguage,
|
fallbackLanguage: customizedLanguage,
|
||||||
fixedLanguage: customizedLanguage,
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
@ -147,7 +146,6 @@ describe('when the application is not admin-console', () => {
|
||||||
languageInfo: {
|
languageInfo: {
|
||||||
autoDetect: false,
|
autoDetect: false,
|
||||||
fallbackLanguage: customizedLanguage,
|
fallbackLanguage: customizedLanguage,
|
||||||
fixedLanguage: customizedLanguage,
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
await expect(phraseRequest.get('/phrase')).resolves.toHaveProperty('status', 200);
|
await expect(phraseRequest.get('/phrase')).resolves.toHaveProperty('status', 200);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { hexColorRegEx, languageKeys } from '@logto/core-kit';
|
import { hexColorRegEx } from '@logto/core-kit';
|
||||||
import { languageTagGuard } from '@logto/language-kit';
|
import { languageTagGuard } from '@logto/language-kit';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
|
|
||||||
|
@ -124,8 +124,6 @@ export type TermsOfUse = z.infer<typeof termsOfUseGuard>;
|
||||||
export const languageInfoGuard = z.object({
|
export const languageInfoGuard = z.object({
|
||||||
autoDetect: z.boolean(),
|
autoDetect: z.boolean(),
|
||||||
fallbackLanguage: languageTagGuard,
|
fallbackLanguage: languageTagGuard,
|
||||||
/** @deprecated */
|
|
||||||
fixedLanguage: z.enum(languageKeys),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
export type LanguageInfo = z.infer<typeof languageInfoGuard>;
|
export type LanguageInfo = z.infer<typeof languageInfoGuard>;
|
||||||
|
|
|
@ -20,7 +20,6 @@ export const defaultSignInExperience: Readonly<CreateSignInExperience> = {
|
||||||
languageInfo: {
|
languageInfo: {
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage: 'en',
|
fallbackLanguage: 'en',
|
||||||
fixedLanguage: 'en',
|
|
||||||
},
|
},
|
||||||
termsOfUse: {
|
termsOfUse: {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
|
|
|
@ -178,7 +178,6 @@ export const mockSignInExperience: SignInExperience = {
|
||||||
languageInfo: {
|
languageInfo: {
|
||||||
autoDetect: true,
|
autoDetect: true,
|
||||||
fallbackLanguage: 'en',
|
fallbackLanguage: 'en',
|
||||||
fixedLanguage: 'zh-CN',
|
|
||||||
},
|
},
|
||||||
signInMethods: {
|
signInMethods: {
|
||||||
username: SignInMethodState.Primary,
|
username: SignInMethodState.Primary,
|
||||||
|
|
Loading…
Reference in a new issue