feat(cms): implement multi-language support across frontend and admin UI
This commit is contained in:
1 parent
730e2a7b48
commit
eac45dd4a7
62 files changed
+1377
-5116
No files matched your search
@@ -0,0 +1,21 @@
|
||||
export function getLocalizedField(field: any, currentLang: string): string {
|
||||
if (field === null || field === undefined) {
|
||||
return '';
|
||||
}
|
||||
if (typeof field === 'string') {
|
||||
return field;
|
||||
}
|
||||
if (typeof field === 'object') {
|
||||
if (field[currentLang] !== undefined) {
|
||||
return field[currentLang];
|
||||
}
|
||||
if (field['en'] !== undefined) {
|
||||
return field['en'];
|
||||
}
|
||||
const keys = Object.keys(field);
|
||||
if (keys.length > 0) {
|
||||
return field[keys[0]];
|
||||
}
|
||||
}
|
||||
return String(field);
|
||||
}
|
||||
Reference in new issue
Block a user