init
Gitea Auto Deploy / Deploy-Container (push) Failing after 52s

This commit is contained in:
2026-04-13 18:05:27 +07:00
commit c77f4a2cb9
207 changed files with 18035 additions and 0 deletions
+62
View File
@@ -0,0 +1,62 @@
import { listCurrentLanguage } from "@/constant/constant";
import { AvatarDetail } from "@/types";
import { useTranslations } from "next-intl"
type TFunc = ReturnType<typeof useTranslations>
function cleanText(text: string): string {
if (!text) return ""
return text.replace(/<unbreak>(.*?)<\/unbreak>/g, "$1")
}
export function getNameChar(
locale: string,
t: TFunc,
data: AvatarDetail | undefined
): string {
if (!data) return "";
if (!Object.prototype.hasOwnProperty.call(listCurrentLanguage, locale)) {
return "";
}
const langKey = listCurrentLanguage[locale as keyof typeof listCurrentLanguage].toLowerCase();
let text = data.Name[langKey] ?? "";
if (!text) {
text = data.Name["en"] ?? "";
}
if (data.ID > 8000) {
text = `${t("trailblazer")} • ${t(data?.BaseType?.toLowerCase() ?? "")}`;
}
return cleanText(text)
}
export function getLocaleName(locale: string, data: Record<string, string> | undefined | null): string {
if (!data) {
return ""
}
if (!Object.prototype.hasOwnProperty.call(listCurrentLanguage, locale)) {
return ""
}
const langKey = listCurrentLanguage[locale as keyof typeof listCurrentLanguage].toLowerCase();
let text = data[langKey] ?? "";
if (!text) {
text = data["en"] ?? "";
}
return cleanText(text)
}
export function parseRuby(text: string): string {
const rubyRegex = /\{RUBY_B#(.*?)\}(.*?)\{RUBY_E#\}/gs;
return text.replace(rubyRegex, (_match, furigana, kanji) => {
return `<ruby>${kanji}<rt>${furigana}</rt></ruby>`;
});
}