Reapply "Add missing admin action files and navigation links"
This reverts commit 4d515bc400.
This commit is contained in:
1 parent
96ed768f14
commit
5b4228261a
338 files changed
+28143
-5948
No files matched your search
+8
-5
@@ -22,9 +22,7 @@ export default getRequestConfig(async () => {
|
||||
// English is the source of truth; fall back to it for any key missing from a
|
||||
// translation so the UI never shows a raw key path.
|
||||
const fallback =
|
||||
locale === DEFAULT_LOCALE
|
||||
? messages
|
||||
: (await import(`../messages/${DEFAULT_LOCALE}.json`)).default;
|
||||
locale === DEFAULT_LOCALE ? messages : (await import(`../messages/${DEFAULT_LOCALE}.json`)).default;
|
||||
|
||||
return {
|
||||
locale,
|
||||
@@ -34,8 +32,13 @@ export default getRequestConfig(async () => {
|
||||
getMessageFallback({ key }: { key: string }) {
|
||||
const fromEnglish = key
|
||||
.split(".")
|
||||
// eslint-disable-next-line security/detect-object-injection -- o guarded as object, k is i18n key segment
|
||||
.reduce<unknown>((o, k) => (o && typeof o === "object" ? (o as Record<string, unknown>)[k] : undefined), fallback);
|
||||
.reduce<unknown>(
|
||||
(o, k) =>
|
||||
o && typeof o === "object"
|
||||
? (o as Record<string, unknown>)[k]
|
||||
: undefined,
|
||||
fallback,
|
||||
);
|
||||
if (typeof fromEnglish === "string") return fromEnglish;
|
||||
const seg = key.split(".").pop() ?? key;
|
||||
return seg.replace(/[._-]/g, " ").replace(/\b\w/g, (c) => c.toUpperCase());
|
||||
|
||||
Reference in new issue
Block a user