fix ja language, instead fetch by axios

This commit is contained in:
2025-05-04 19:26:14 +07:00
parent fbdfa6d557
commit 08df765d25
12 changed files with 263 additions and 91 deletions

View File

@@ -12,13 +12,19 @@ export function getNameChar(locale: string, data: AvatarHakushiType | undefined)
let text = data.lang.get(listCurrentLanguage[locale as keyof typeof listCurrentLanguage].toLowerCase()) ?? "";
if (!text) {
text = data.lang.get("en") ?? "";
text = data.lang.get("en") ?? "";
}
if (Number(data.id) % 2 === 0 && Number(data.id) > 8000) {
text = `Female ${data.damageType} MC`
text = `Female ${data.damageType} MC`
} else if (Number(data.id) > 8000) {
text = `Male ${data.damageType} MC`
text = `Male ${data.damageType} MC`
}
return 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>`;
});
}