mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
refactor(console): use non-i18n raw string in language select box
This commit is contained in:
parent
1afb6dd467
commit
1592cd0b0b
8 changed files with 9 additions and 40 deletions
|
@ -1,4 +1,4 @@
|
|||
import { Language } from '@logto/phrases';
|
||||
import { languageOptions } from '@logto/phrases';
|
||||
import { AppearanceMode } from '@logto/schemas';
|
||||
import classNames from 'classnames';
|
||||
import { Controller, useForm } from 'react-hook-form';
|
||||
|
@ -58,16 +58,7 @@ const Settings = () => {
|
|||
render={({ field: { value, onChange } }) => (
|
||||
<Select
|
||||
value={value ?? defaultLanguage}
|
||||
options={[
|
||||
{
|
||||
value: Language.English,
|
||||
title: t('settings.language_english'),
|
||||
},
|
||||
{
|
||||
value: Language.Chinese,
|
||||
title: t('settings.language_chinese'),
|
||||
},
|
||||
]}
|
||||
options={languageOptions}
|
||||
onChange={onChange}
|
||||
/>
|
||||
)}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { Language } from '@logto/phrases';
|
||||
import { useMemo } from 'react';
|
||||
import { languageOptions } from '@logto/phrases';
|
||||
import { Controller, useFormContext } from 'react-hook-form';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
|
||||
|
@ -15,20 +14,6 @@ const LanguagesForm = () => {
|
|||
const { watch, control } = useFormContext<SignInExperienceForm>();
|
||||
const mode = watch('languageInfo.mode');
|
||||
|
||||
const languageOptions = useMemo(
|
||||
() => [
|
||||
{
|
||||
value: Language.English,
|
||||
title: t('sign_in_exp.others.languages.languages.english'),
|
||||
},
|
||||
{
|
||||
value: Language.Chinese,
|
||||
title: t('sign_in_exp.others.languages.languages.chinese'),
|
||||
},
|
||||
],
|
||||
[t]
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<div className={styles.title}>{t('sign_in_exp.others.languages.title')}</div>
|
||||
|
|
|
@ -4,7 +4,7 @@ import en from './locales/en';
|
|||
import zhCN from './locales/zh-cn';
|
||||
import { Resource, Language } from './types';
|
||||
|
||||
export { Language } from './types';
|
||||
export { Language, languageOptions } from './types';
|
||||
export type Translation = typeof en.translation;
|
||||
export type Errors = typeof en.errors;
|
||||
export type LogtoErrorCode = NormalizeKeyPaths<Errors>;
|
||||
|
|
|
@ -6,8 +6,6 @@ const settings = {
|
|||
},
|
||||
custom_domain: 'Custom domain',
|
||||
language: 'Language',
|
||||
language_english: 'English',
|
||||
language_chinese: 'Chinese',
|
||||
appearance: 'Appearance',
|
||||
appearance_system: 'Sync with system',
|
||||
appearance_light: 'Light mode',
|
||||
|
|
|
@ -78,10 +78,6 @@ const sign_in_exp = {
|
|||
fallback_language_tip:
|
||||
'Which language to fall back if Logto finds no proper language phrase-set.',
|
||||
fixed_language: 'Fixed language',
|
||||
languages: {
|
||||
english: 'English',
|
||||
chinese: 'Chinese',
|
||||
},
|
||||
},
|
||||
},
|
||||
setup_warning: {
|
||||
|
|
|
@ -6,8 +6,6 @@ const settings = {
|
|||
},
|
||||
custom_domain: '自定义域名',
|
||||
language: '语言',
|
||||
language_english: '英语',
|
||||
language_chinese: '中文',
|
||||
appearance: '外观',
|
||||
appearance_system: '跟随系统',
|
||||
appearance_light: '浅色模式',
|
||||
|
|
|
@ -74,10 +74,6 @@ const sign_in_exp = {
|
|||
fallback_language: '备用语言',
|
||||
fallback_language_tip: '如果 Logto 找不到合适的语言包,将回退至哪种语言。',
|
||||
fixed_language: '固定语言',
|
||||
languages: {
|
||||
english: '英文',
|
||||
chinese: '中文',
|
||||
},
|
||||
},
|
||||
},
|
||||
setup_warning: {
|
||||
|
|
|
@ -14,4 +14,9 @@ export enum Language {
|
|||
Chinese = 'zh-CN',
|
||||
}
|
||||
|
||||
export const languageOptions = [
|
||||
{ value: Language.English, title: 'English' },
|
||||
{ value: Language.Chinese, title: '中文' },
|
||||
];
|
||||
|
||||
/* eslint-enable @typescript-eslint/consistent-indexed-object-style */
|
||||
|
|
Loading…
Add table
Reference in a new issue