|
1 | | -import { createUseI18n } from "keycloakify/login"; |
| 1 | +import { i18nBuilder } from "keycloakify/login"; |
| 2 | +import type { ThemeName } from "src/kc.gen"; |
2 | 3 |
|
3 | | -export const { useI18n, ofTypeI18n } = createUseI18n({ |
4 | | - // NOTE: Here you can override the default i18n messages |
5 | | - // or define new ones that, for example, you would have |
6 | | - // defined in the Keycloak admin UI for UserProfile |
7 | | - // https://user-images.githubusercontent.com/6702424/182050652-522b6fe6-8ee5-49df-aca3-dba2d33f24a5.png |
8 | | - en: { |
9 | | - // Here we overwrite the default english value for the message "doForgotPassword" |
10 | | - // that is "Forgot Password?" see: https://github.com/InseeFrLab/keycloakify/blob/f0ae5ea908e0aa42391af323b6d5e2fd371af851/src/lib/i18n/generated_messages/18.0.1/login/en.ts#L17 |
11 | | - doRegister: "Sign up", |
12 | | - dontYetHaveAnAccount: "Don't yet have an account?", |
13 | | - forgotPassword: "Forgot Password", |
14 | | - rememberMe: "Remember me on this device", |
15 | | - resendConfirmationEmail: "Resend confirmation email", |
16 | | - troubleSigningIn: "Trouble signing in?", |
17 | | - usernameOrEmail: "Email address", |
18 | | - emailNotVerified: |
19 | | - "Your email account has not been verified. Please verify your email before proceeding.", |
20 | | - }, |
21 | | - "zh-CN": { |
22 | | - doRegister: "注册", |
23 | | - dontYetHaveAnAccount: "还没有账户?", |
24 | | - forgotPassword: "忘记密码", |
25 | | - rememberMe: "在这台设备上记住我", |
26 | | - resendConfirmationEmail: "重新发送确认邮件", |
27 | | - troubleSigningIn: "登录遇到问题?", |
28 | | - usernameOrEmail: "电子邮箱地址", |
29 | | - emailNotVerified: |
30 | | - "您的电子邮件帐户尚未经过验证。 请在继续之前验证您的电子邮件。", |
31 | | - }, |
32 | | -}); |
| 4 | +const { useI18n, ofTypeI18n } = i18nBuilder |
| 5 | + .withThemeName<ThemeName>() |
| 6 | + .withCustomTranslations({ |
| 7 | + // NOTE: Here you can override the default i18n messages |
| 8 | + // or define new ones that, for example, you would have |
| 9 | + // defined in the Keycloak admin UI for UserProfile |
| 10 | + // https://user-images.githubusercontent.com/6702424/182050652-522b6fe6-8ee5-49df-aca3-dba2d33f24a5.png |
| 11 | + en: { |
| 12 | + // Here we overwrite the default english value for the message "doForgotPassword" |
| 13 | + // that is "Forgot Password?" see: https://github.com/InseeFrLab/keycloakify/blob/f0ae5ea908e0aa42391af323b6d5e2fd371af851/src/lib/i18n/generated_messages/18.0.1/login/en.ts#L17 |
| 14 | + doRegister: "Sign up", |
| 15 | + dontYetHaveAnAccount: "Don't yet have an account?", |
| 16 | + forgotPassword: "Forgot Password", |
| 17 | + rememberMe: "Remember me on this device", |
| 18 | + resendConfirmationEmail: "Resend confirmation email", |
| 19 | + troubleSigningIn: "Trouble signing in?", |
| 20 | + usernameOrEmail: "Email address", |
| 21 | + emailNotVerified: |
| 22 | + "Your email account has not been verified. Please verify your email before proceeding.", |
| 23 | + }, |
| 24 | + "zh-CN": { |
| 25 | + doRegister: "注册", |
| 26 | + dontYetHaveAnAccount: "还没有账户?", |
| 27 | + forgotPassword: "忘记密码", |
| 28 | + rememberMe: "在这台设备上记住我", |
| 29 | + resendConfirmationEmail: "重新发送确认邮件", |
| 30 | + troubleSigningIn: "登录遇到问题?", |
| 31 | + usernameOrEmail: "电子邮箱地址", |
| 32 | + emailNotVerified: |
| 33 | + "您的电子邮件帐户尚未经过验证。 请在继续之前验证您的电子邮件。", |
| 34 | + }, |
| 35 | + }) |
| 36 | + .build(); |
33 | 37 |
|
34 | | -export type I18n = typeof ofTypeI18n; |
| 38 | +type I18n = typeof ofTypeI18n; |
| 39 | + |
| 40 | +export { type I18n, useI18n }; |
0 commit comments