update for v4

This commit is contained in:
2025-04-27 13:53:19 +07:00
parent e1e876a4e8
commit 6a9731b882
15 changed files with 470 additions and 170 deletions

View File

@@ -1,3 +1,4 @@
import { listCurrentLanguage } from "@/lib/constant";
import { AvatarType } from "@/types";
@@ -5,7 +6,11 @@ export function getNameChar(locale: string, data: AvatarType | undefined): strin
if (!data) {
return ""
}
let text = data.lang.get(locale) ?? "";
if (!listCurrentLanguage.hasOwnProperty(locale)) {
return ""
}
let text = data.lang.get(listCurrentLanguage[locale as keyof typeof listCurrentLanguage].toLowerCase()) ?? "";
if (!text) {
text = data.lang.get("en") ?? "";
}