mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 23:28:11 +00:00
fix ui
This commit is contained in:
@@ -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],
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user