user management ui

This commit is contained in:
yaschalew
2026-07-10 10:41:48 +03:00
parent dcb2d98503
commit 28a20923ff
595 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +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],
);
};