159 lines
7.5 KiB
TypeScript
159 lines
7.5 KiB
TypeScript
export type Locale = "th" | "en";
|
||
|
||
const english = {
|
||
exportImage: "Export image",
|
||
withoutNote: "Export without note",
|
||
exporting: "Exporting…",
|
||
exportError: "Could not export the image. Please try again.",
|
||
damageTitle: "Choose a damage metric",
|
||
damageDescription: "Choose the damage metric for your weapon comparison image.",
|
||
overallDamage: "Overall Damage",
|
||
personalDamage: "Personal Damage",
|
||
weaponTitle: "{name}’s Weapon Comparison",
|
||
condition: "Condition {index}",
|
||
sectionTitle: "Choose what to export",
|
||
sectionDescription: "Select individual sections or choose All sections to export everything.",
|
||
allSections: "All sections",
|
||
tierlist: "Artifact Tier List",
|
||
bestStats: "Best Main Stats & Substats",
|
||
targetStats: "Target Stats",
|
||
talents: "Talent Priority",
|
||
addNote: "Include note",
|
||
recommendedCondition: "Recommended stats condition",
|
||
targetCondition: "Target stats condition",
|
||
mainStats: "Best Main Stats",
|
||
substats: "Best Substats",
|
||
sands: "Sands",
|
||
goblet: "Goblet",
|
||
circlet: "Circlet",
|
||
artifactRecommendation: "Recommended Artifacts & Stats",
|
||
artifactTitle: "Artifacts & Stats",
|
||
lateGame: "Late Game",
|
||
earlyGame: "Early Game",
|
||
minimumStats: "Recommended Minimum Stats",
|
||
level: "Level {level}+",
|
||
normalAttack: "Normal Attack",
|
||
skill: "Elemental Skill",
|
||
burst: "Elemental Burst",
|
||
note: "Notes",
|
||
extraGuide: "Additional Guide",
|
||
missingItem: "Item unavailable",
|
||
constellationTitle: "{name}’s Constellations",
|
||
teamDamage: "Team Damage",
|
||
rotation: "Rotation duration: {seconds} seconds",
|
||
teamCredit: "By YT Genshin Is Not a Mobile Game",
|
||
disclaimer: "Results cannot be directly compared with other theorycrafters’ calculations,\nas each uses different stats.\nThe figures shown may change in future updates.",
|
||
overviewDownloaded: "Overview image downloaded.",
|
||
downloadPng: "Download PNG {width}×{height}",
|
||
materials: "MATERIALS",
|
||
materialLevel: "LV.{level}"
|
||
} as const;
|
||
|
||
export type ExportMessageKey = keyof typeof english;
|
||
|
||
const thai: Record<ExportMessageKey, string> = {
|
||
exportImage: "ส่งออกภาพ",
|
||
withoutNote: "ส่งออกภาพโดยไม่รวมโน้ต",
|
||
exporting: "กำลังส่งออก…",
|
||
exportError: "ส่งออกภาพไม่สำเร็จ กรุณาลองอีกครั้ง",
|
||
damageTitle: "เลือกประเภทดาเมจ",
|
||
damageDescription: "เลือกค่าที่ต้องการใช้สร้างภาพเปรียบเทียบอาวุธ",
|
||
overallDamage: "ดาเมจทั้งทีม",
|
||
personalDamage: "ดาเมจส่วนตัว",
|
||
weaponTitle: "เปรียบเทียบอาวุธของ {name}",
|
||
condition: "เงื่อนไข {index}",
|
||
sectionTitle: "เลือกข้อมูลสำหรับส่งออก",
|
||
sectionDescription: "เลือกได้หลายส่วน หรือเลือกทั้งหมดเพื่อส่งออกทุกส่วน",
|
||
allSections: "ทั้งหมด",
|
||
tierlist: "อันดับอาร์ติแฟกต์",
|
||
bestStats: "ออฟหลักและออฟรองที่ดีที่สุด",
|
||
targetStats: "ค่าสถานะเป้าหมาย",
|
||
talents: "ลำดับการอัพพรสวรรค์",
|
||
addNote: "รวมโน้ต",
|
||
recommendedCondition: "เงื่อนไขค่าสถานะแนะนำ",
|
||
targetCondition: "เงื่อนไขค่าสถานะเป้าหมาย",
|
||
mainStats: "ออฟหลักที่ดีที่สุด",
|
||
substats: "ออฟรองที่ดีที่สุด",
|
||
sands: "นาฬิกา",
|
||
goblet: "ถ้วย",
|
||
circlet: "หัว",
|
||
artifactRecommendation: "อาร์ติแฟกต์และสแตทที่แนะนำ",
|
||
artifactTitle: "Artifact & Stats",
|
||
lateGame: "เลทเกม",
|
||
earlyGame: "ต้นเกม",
|
||
minimumStats: "ค่าสถานะต่ำๆที่ควรจะปั้นไว้",
|
||
level: "เลเวล {level}+",
|
||
normalAttack: "ตีปกติ",
|
||
skill: "สกิลธาตุ",
|
||
burst: "ท่าไม้ตาย",
|
||
note: "โน็ต",
|
||
extraGuide: "คู่มือเสริม",
|
||
missingItem: "ไม่พบรายการ",
|
||
constellationTitle: "กลุ่มดาวของ {name}",
|
||
teamDamage: "ดาเมจทั้งทีม",
|
||
rotation: "ระยะเวลาโรเทชั่น {seconds} วิ",
|
||
teamCredit: "By YT เกนชินไม่ใช่เกมมือถือ",
|
||
disclaimer: "ไม่สามารถเอาไปเปรียบเทียบกับการคำนวณของ TC ท่านอื่นๆได้\nเพราะแต่ละคนใช้สแตทในการคำนวณที่ไม่เหมือนกัน\nและตารางที่เห็นอาจมีการเปลี่ยนแปลงได้ในอนาคต",
|
||
overviewDownloaded: "ดาวน์โหลดภาพ Overview แล้ว",
|
||
downloadPng: "ดาวน์โหลด PNG {width}×{height}",
|
||
materials: "วัสดุ",
|
||
materialLevel: "เลเวล {level}"
|
||
};
|
||
|
||
export const exportMessages = { en: english, th: thai };
|
||
|
||
export function exportText(
|
||
key: ExportMessageKey,
|
||
params: Record<string, string | number> = {},
|
||
locale: Locale = "en",
|
||
): string {
|
||
return exportMessages[locale][key].replace(
|
||
/\{(\w+)\}/gu,
|
||
(placeholder, name: string) => String(params[name] ?? placeholder),
|
||
);
|
||
}
|
||
|
||
export function withoutNotesFileName(fileName: string): string {
|
||
return /\.[^.]+$/u.test(fileName)
|
||
? fileName.replace(/(\.[^.]+)$/u, "-without-notes$1")
|
||
: `${fileName}-without-notes`;
|
||
}
|
||
|
||
const thaiStats: Record<string, string> = {
|
||
HP: "พลังชีวิต",
|
||
ATK: "พลังโจมตี",
|
||
DEF: "พลังป้องกัน",
|
||
EM: "ความชำนาญธาตุ",
|
||
ER: "ฟื้นฟูพลังงาน",
|
||
"CRIT RATE": "อัตราคริ",
|
||
"CRIT DAMAGE": "ความแรงคริ",
|
||
"ATK%": "พลังโจมตี%",
|
||
"HP%": "พลังชีวิต%",
|
||
"DEF%": "พลังป้องกัน%",
|
||
"CRIT Rate%/CRIT DMG%": "อัตราคริ/ความแรงคริ",
|
||
"Pyro DMG%": "ความเสียหายธาตุไฟ%",
|
||
"Hydro DMG%": "ความเสียหายธาตุน้ำ%",
|
||
"Cryo DMG%": "ความเสียหายธาตุน้ำแข็ง%",
|
||
"Electro DMG%": "ความเสียหายธาตุไฟฟ้า%",
|
||
"Anemo DMG%": "ความเสียหายธาตุลม%",
|
||
"Geo DMG%": "ความเสียหายธาตุดิน%",
|
||
"Dendro DMG%": "ความเสียหายธาตุไม้%",
|
||
"Physical DMG%": "ความเสียหายกายภาพ%",
|
||
"Healing Bonus%": "โบนัสการรักษา%",
|
||
};
|
||
|
||
const englishStats: Record<string, string> = {
|
||
HP: "HP",
|
||
ATK: "ATK",
|
||
DEF: "DEF",
|
||
EM: "Elemental Mastery",
|
||
ER: "Energy Recharge",
|
||
"CRIT RATE": "CRIT Rate",
|
||
"CRIT DAMAGE": "CRIT DMG",
|
||
"CRIT Rate%/CRIT DMG%": "CRIT Rate / CRIT DMG",
|
||
};
|
||
|
||
export function exportStatLabel(value: string, locale: Locale = "en"): string {
|
||
return (locale === "th" ? thaiStats : englishStats)[value] ?? value;
|
||
}
|