mirror of
https://github.com/logto-io/logto.git
synced 2025-01-27 21:39:16 -05:00
fix(ui): add i18n formater for zh-CN list (#1009)
add i18n formater for zh-CN list
This commit is contained in:
parent
8a52c84e32
commit
ca5c8aaec1
2 changed files with 16 additions and 5 deletions
|
@ -29,9 +29,9 @@ const translation = {
|
|||
confirm_password: '确认密码',
|
||||
},
|
||||
secondary: {
|
||||
sign_in_with: '通过 {{methods, list(type: disjunction;)}} 登录',
|
||||
sign_in_with: '通过 {{methods, list(type: disjunction;), zhOrSpaces}} 登录',
|
||||
social_bind_with:
|
||||
'Already have an account? Sign in to bind {{methods, list(type: disjunction;)}} with your social identity.',
|
||||
'绑定到已有账户? 使用 {{methods, list(type: disjunction;), zhOrSpaces}} 登录并绑定。',
|
||||
},
|
||||
action: {
|
||||
sign_in: '登录',
|
||||
|
@ -67,8 +67,8 @@ const translation = {
|
|||
resend_after_seconds: '在 {{ seconds }} 秒后重发',
|
||||
resend_passcode: '重发验证码',
|
||||
continue_with: '通过以下方式继续',
|
||||
create_account_id_exists: '{{ type }}为 {{ value }} 的账号已存在,您要登录吗?',
|
||||
sign_in_id_does_not_exists: '{{ type }}为 {{ value }} 的账号不存在,您要创建一个新账号吗?',
|
||||
create_account_id_exists: '{{type}}为 {{ value }} 的账号已存在,您要登录吗?',
|
||||
sign_in_id_does_not_exists: '{{type}}为 {{ value }} 的账号不存在,您要创建一个新账号吗?',
|
||||
bind_account_title: '绑定 Logto 账号',
|
||||
social_create_account: 'No account? You can create a new account and bind.',
|
||||
social_bind_account: 'Already have an account? Sign in to bind it with your social identity.',
|
||||
|
|
|
@ -18,7 +18,18 @@ const initI18n = async (languageSettings?: LanguageInfo) => {
|
|||
? { ...baseOptions, lng: languageSettings.fixedLanguage }
|
||||
: baseOptions;
|
||||
|
||||
return i18next.use(initReactI18next).use(LanguageDetector).init(options);
|
||||
const i18n = i18next.use(initReactI18next).use(LanguageDetector).init(options);
|
||||
|
||||
// @ts-expect-error - i18next doesn't have a type definition for this. called after i18next is initialized
|
||||
i18next.services.formatter.add('zhOrSpaces', (value: string, lng) => {
|
||||
if (lng !== 'zh-CN') {
|
||||
return value;
|
||||
}
|
||||
|
||||
return value.replaceAll(/或/g, ' 或 ');
|
||||
});
|
||||
|
||||
return i18n;
|
||||
};
|
||||
|
||||
export default initI18n;
|
||||
|
|
Loading…
Add table
Reference in a new issue