feat: implemented new i18n system
This commit is contained in:
parent
4b4e8b7aa8
commit
032cfb2bfd
11 changed files with 254 additions and 124 deletions
16
apps/vdn-static/src/utils/localizeLayout.ts
Normal file
16
apps/vdn-static/src/utils/localizeLayout.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
import type { Layout } from "@/i18n/locale";
|
||||
import type { DeepReadonly } from "vue";
|
||||
|
||||
export function localizeLayout<T>(
|
||||
layout: DeepReadonly<Layout<T>>,
|
||||
): T[keyof T][] {
|
||||
const sections: T[keyof T][] = [];
|
||||
for (const sectionId of layout.layout) {
|
||||
const section = (layout.data as T)[sectionId as keyof T];
|
||||
if (section) {
|
||||
sections.push(section);
|
||||
}
|
||||
}
|
||||
|
||||
return sections;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue