feat: i18n add world/group detail strings and format helpers

This commit is contained in:
2026-06-29 03:30:21 +07:00
parent e1c03f9deb
commit bbe68dc8ca
7 changed files with 156 additions and 0 deletions
+12
View File
@@ -29,6 +29,18 @@ export function prettyTag(tag: string, prefix = ""): string {
return label.charAt(0).toUpperCase() + label.slice(1); return label.charAt(0).toUpperCase() + label.slice(1);
} }
export function tagsWithPrefix(tags: readonly string[], prefix: string): string[] {
return tags.filter((t) => t.startsWith(prefix));
}
export function prettyLink(url: string): string {
try {
return new URL(url).hostname.replace(/^www\./, "");
} catch {
return url;
}
}
export function platformLabel(p: string): string { export function platformLabel(p: string): string {
if (p === "standalonewindows") return "PC (Windows)"; if (p === "standalonewindows") return "PC (Windows)";
if (p === "android") return "Quest / Android"; if (p === "android") return "Quest / Android";
@@ -0,0 +1,20 @@
{
"ownedByPrefix": "owned by",
"ownerUnknown": "Unknown owner",
"stats": {
"members": "Members",
"online": "Online",
"languages": "Languages"
},
"sections": {
"about": "About",
"rules": "Rules",
"details": "Details",
"tags": "Tags"
},
"facts": {
"joining": "Joining",
"created": "Created",
"groupId": "Group ID"
}
}
@@ -37,6 +37,34 @@
"copy": "Copy", "copy": "Copy",
"copied": "Copied" "copied": "Copied"
}, },
"detail": {
"byPrefix": "by",
"stats": {
"playersNow": "Players now",
"favorites": "Favorites",
"visits": "Visits",
"capacity": "Capacity"
},
"sections": {
"description": "Description",
"trailer": "Trailer",
"details": "Details",
"tags": "Tags"
},
"facts": {
"recommended": "Recommended",
"popularity": "Popularity",
"heat": "Heat",
"version": "Version",
"published": "Published",
"communityLabs": "Community Labs",
"created": "Created",
"updated": "Updated",
"worldId": "World ID"
},
"recommendedValue": "{{count}} players",
"noAuthorTags": "No author tags"
},
"instance": { "instance": {
"title": "Instance", "title": "Instance",
"unavailable": "This instance is no longer available.", "unavailable": "This instance is no longer available.",
@@ -0,0 +1,20 @@
{
"ownedByPrefix": "オーナー:",
"ownerUnknown": "不明なオーナー",
"stats": {
"members": "メンバー",
"online": "オンライン",
"languages": "言語"
},
"sections": {
"about": "概要",
"rules": "ルール",
"details": "詳細",
"tags": "タグ"
},
"facts": {
"joining": "参加方法",
"created": "作成日",
"groupId": "グループID"
}
}
@@ -37,6 +37,34 @@
"copy": "コピー", "copy": "コピー",
"copied": "コピーしました" "copied": "コピーしました"
}, },
"detail": {
"byPrefix": "作者:",
"stats": {
"playersNow": "現在のプレイヤー",
"favorites": "お気に入り",
"visits": "訪問数",
"capacity": "定員"
},
"sections": {
"description": "説明",
"trailer": "トレーラー",
"details": "詳細",
"tags": "タグ"
},
"facts": {
"recommended": "推奨人数",
"popularity": "人気度",
"heat": "ヒート",
"version": "バージョン",
"published": "公開日",
"communityLabs": "Community Labs",
"created": "作成日",
"updated": "更新日",
"worldId": "ワールドID"
},
"recommendedValue": "{{count}} 人",
"noAuthorTags": "作者タグはありません"
},
"instance": { "instance": {
"title": "インスタンス", "title": "インスタンス",
"unavailable": "このインスタンスはもう利用できません。", "unavailable": "このインスタンスはもう利用できません。",
@@ -0,0 +1,20 @@
{
"ownedByPrefix": "เจ้าของโดย",
"ownerUnknown": "ไม่ทราบเจ้าของ",
"stats": {
"members": "สมาชิก",
"online": "ออนไลน์",
"languages": "ภาษา"
},
"sections": {
"about": "เกี่ยวกับ",
"rules": "กฎ",
"details": "รายละเอียด",
"tags": "แท็ก"
},
"facts": {
"joining": "การเข้าร่วม",
"created": "สร้างเมื่อ",
"groupId": "ไอดีกลุ่ม"
}
}
@@ -37,6 +37,34 @@
"copy": "คัดลอก", "copy": "คัดลอก",
"copied": "คัดลอกแล้ว" "copied": "คัดลอกแล้ว"
}, },
"detail": {
"byPrefix": "โดย",
"stats": {
"playersNow": "ผู้เล่นตอนนี้",
"favorites": "รายการโปรด",
"visits": "การเข้าชม",
"capacity": "ความจุ"
},
"sections": {
"description": "คำอธิบาย",
"trailer": "ตัวอย่าง",
"details": "รายละเอียด",
"tags": "แท็ก"
},
"facts": {
"recommended": "แนะนำ",
"popularity": "ความนิยม",
"heat": "ความฮอต",
"version": "เวอร์ชัน",
"published": "เผยแพร่เมื่อ",
"communityLabs": "Community Labs",
"created": "สร้างเมื่อ",
"updated": "อัปเดตเมื่อ",
"worldId": "ไอดีเวิลด์"
},
"recommendedValue": "{{count}} คน",
"noAuthorTags": "ไม่มีแท็กผู้สร้าง"
},
"instance": { "instance": {
"title": "อินสแตนซ์", "title": "อินสแตนซ์",
"unavailable": "อินสแตนซ์นี้ไม่สามารถใช้งานได้แล้ว", "unavailable": "อินสแตนซ์นี้ไม่สามารถใช้งานได้แล้ว",