This commit is contained in:
natib21
2026-07-10 11:25:59 +00:00
parent 2696ca7498
commit e6e44e773b
1146 changed files with 200266 additions and 90527 deletions

View File

@@ -1,21 +1,21 @@
import { useCallback } from "react";
import { useTranslation } from "react-i18next";
export type LocalizedText = {
am?: string;
en?: string;
};
export const useLocalizedName = (language?: string) => {
const { i18n } = useTranslation();
const currentLanguage = language || i18n.language;
return useCallback(
(name?: LocalizedText): string => {
if (!name) return "";
const am = name.am?.trim() ?? "";
const en = name.en?.trim() ?? "";
return (currentLanguage.startsWith("am") ? am || en : en || am) || "";
},
[currentLanguage],
);
};
import { useCallback } from "react";
import { useTranslation } from "react-i18next";
export type LocalizedText = {
am?: string;
en?: string;
};
export const useLocalizedName = (language?: string) => {
const { i18n } = useTranslation();
const currentLanguage = language || i18n.language;
return useCallback(
(name?: LocalizedText): string => {
if (!name) return "";
const am = name.am?.trim() ?? "";
const en = name.en?.trim() ?? "";
return (currentLanguage.startsWith("am") ? am || en : en || am) || "";
},
[currentLanguage],
);
};