fix useKcMessage
This commit is contained in:
@ -64,16 +64,17 @@ export function useKcMessage() {
|
|||||||
(key: string): string | undefined => {
|
(key: string): string | undefined => {
|
||||||
const match = key.match(/^\$\{([^{]+)\}$/);
|
const match = key.match(/^\$\{([^{]+)\}$/);
|
||||||
|
|
||||||
if (match === null) {
|
const resolvedKey = match === null ? key : match[1];
|
||||||
return key;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
const out =
|
||||||
id<Record<string, string | undefined>>(
|
id<Record<string, string | undefined>>(
|
||||||
kcMessages[kcLanguageTag],
|
kcMessages[kcLanguageTag],
|
||||||
)[key] ??
|
)[resolvedKey] ??
|
||||||
id<Record<string, string | undefined>>(kcMessages["en"])[key]
|
id<Record<string, string | undefined>>(kcMessages["en"])[
|
||||||
);
|
resolvedKey
|
||||||
|
];
|
||||||
|
|
||||||
|
return out !== undefined ? out : match === null ? key : undefined;
|
||||||
},
|
},
|
||||||
[msgStr],
|
[msgStr],
|
||||||
);
|
);
|
||||||
|
Reference in New Issue
Block a user