Various little adjustments relative to the new i18n API
This commit is contained in:
parent
e8d3d3d741
commit
8623037224
@ -1,3 +1,3 @@
|
||||
export type { ExtendKcContext } from "keycloakify/account/KcContext";
|
||||
export type { ClassKey } from "keycloakify/account/TemplateProps";
|
||||
export { createUseI18n } from "keycloakify/account/i18n";
|
||||
export { i18nInitializer, type MessageKey_defaultSet } from "keycloakify/account/i18n";
|
||||
|
@ -1,2 +1,3 @@
|
||||
export type { KcContextLike } from "./getI18n";
|
||||
export { i18nInitializer } from "./i18nInitializer";
|
||||
export type { MessageKey as MessageKey_defaultSet } from "../messages_defaultSet/types";
|
||||
|
@ -1,2 +1,3 @@
|
||||
export { i18nInitializer } from "./i18nInitializer";
|
||||
export type { KcContextLike } from "./useI18n";
|
||||
export type { MessageKey as MessageKey_defaultSet } from "../messages_defaultSet/types";
|
||||
|
@ -12,6 +12,8 @@ export type ReturnTypeOfCreateUseI18n<MessageKey_themeDefined extends string, La
|
||||
ofTypeI18n: GenericI18n<MessageKey_defaultSet | MessageKey_themeDefined, LanguageTag_defaultSet | LanguageTag_notInDefaultSet>;
|
||||
};
|
||||
|
||||
export { KcContextLike };
|
||||
|
||||
export function createUseI18n<
|
||||
ThemeName extends string = string,
|
||||
MessageKey_themeDefined extends string = never,
|
||||
|
@ -1,3 +1,3 @@
|
||||
export type { ExtendKcContext, Attribute } from "keycloakify/login/KcContext";
|
||||
export type { ClassKey } from "keycloakify/login/TemplateProps";
|
||||
export { createUseI18n, i18nApi } from "keycloakify/login/i18n";
|
||||
export { i18nInitializer, type MessageKey_defaultSet } from "keycloakify/login/i18n";
|
||||
|
@ -10,7 +10,7 @@ import { useInsertScriptTags } from "keycloakify/tools/useInsertScriptTags";
|
||||
import type { PasswordPolicies, Attribute, Validators } from "keycloakify/login/KcContext";
|
||||
import type { KcContext } from "../KcContext";
|
||||
import type { MessageKey_defaultSet } from "keycloakify/login/i18n";
|
||||
import { KcContextLike as KcContextLike_i18n } from "keycloakify/login/i18n";
|
||||
import type { KcContextLike as KcContextLike_i18n } from "keycloakify/login/i18n";
|
||||
import type { I18n } from "../i18n";
|
||||
|
||||
export type FormFieldError = {
|
||||
|
@ -1,5 +1,9 @@
|
||||
import { createUseI18n } from "../../dist/account";
|
||||
import { i18nInitializer } from "../../dist/account";
|
||||
import type { ThemeName } from "../kc.gen";
|
||||
|
||||
export const { useI18n, ofTypeI18n } = createUseI18n({});
|
||||
export const { useI18n, ofTypeI18n } = i18nInitializer
|
||||
.withThemeName<ThemeName>()
|
||||
.withCustomTranslations({})
|
||||
.create();
|
||||
|
||||
export type I18n = typeof ofTypeI18n;
|
||||
|
@ -1,9 +1,9 @@
|
||||
import { i18nApi } from "../../dist/login";
|
||||
import { i18nInitializer } from "../../dist/login";
|
||||
import type { ThemeName } from "../kc.gen";
|
||||
|
||||
export const { useI18n, ofTypeI18n } = i18nApi
|
||||
export const { useI18n, ofTypeI18n } = i18nInitializer
|
||||
.withThemeName<ThemeName>()
|
||||
.withTranslations({})
|
||||
.withCustomTranslations({})
|
||||
.create();
|
||||
|
||||
export type I18n = typeof ofTypeI18n;
|
||||
|
@ -5,7 +5,10 @@ import { Reflect } from "tsafe/Reflect";
|
||||
const { useI18n, ofTypeI18n } = i18nInitializer
|
||||
.withThemeName<"my-theme-1" | "my-theme-2">()
|
||||
.withExtraLanguages({
|
||||
he: () => import("./he")
|
||||
he: {
|
||||
label: "עברית",
|
||||
getMessages: () => import("./he")
|
||||
}
|
||||
})
|
||||
.withCustomTranslations({
|
||||
en: {
|
||||
|
Loading…
x
Reference in New Issue
Block a user