From cc4094549e83addedd062c7cd2d09e6b32161894 Mon Sep 17 00:00:00 2001
From: Tesutarin <105267106+Tesutarin@users.noreply.github.com>
Date: Wed, 15 Jun 2022 10:22:55 +0800
Subject: [PATCH] Gacha Records: Support multiple languages
---
.../emu/grasscutter/server/http/handlers/GachaHandler.java | 3 +++
src/main/resources/defaults/data/gacha/records.html | 6 +++---
src/main/resources/languages/en-US.json | 5 +++++
src/main/resources/languages/fr-FR.json | 5 +++++
src/main/resources/languages/pl-PL.json | 5 +++++
src/main/resources/languages/zh-CN.json | 5 +++++
src/main/resources/languages/zh-TW.json | 5 +++++
7 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java b/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java
index 3acb5a106..69a0c67ce 100644
--- a/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java
+++ b/src/main/java/emu/grasscutter/server/http/handlers/GachaHandler.java
@@ -70,6 +70,9 @@ public final class GachaHandler implements Router {
String template = new String(FileUtils.read(recordsTemplate), StandardCharsets.UTF_8)
.replace("{{REPLACE_RECORDS}}", records)
.replace("{{REPLACE_MAXPAGE}}", String.valueOf(maxPage))
+ .replace("{{TITLE}}", translate(player, "gacha.records.title"))
+ .replace("{{DATE}}", translate(player, "gacha.records.date"))
+ .replace("{{ITEM}}", translate(player, "gacha.records.item"))
.replace("{{LANGUAGE}}", Utils.getLanguageCode(account.getLocale()));
response.send(template);
}
diff --git a/src/main/resources/defaults/data/gacha/records.html b/src/main/resources/defaults/data/gacha/records.html
index cad1c89d5..ad2466e9c 100644
--- a/src/main/resources/defaults/data/gacha/records.html
+++ b/src/main/resources/defaults/data/gacha/records.html
@@ -67,12 +67,12 @@
-
Gacha Records
+
{{TITLE}}
- Date |
- Item |
+ {{DATE}} |
+ {{ITEM}} |
diff --git a/src/main/resources/languages/en-US.json b/src/main/resources/languages/en-US.json
index 0cca8d85d..d349f0b3f 100644
--- a/src/main/resources/languages/en-US.json
+++ b/src/main/resources/languages/en-US.json
@@ -399,6 +399,11 @@
"available_five_stars": "Available 5-star Items",
"available_four_stars": "Available 4-star Items",
"available_three_stars": "Available 3-star Items"
+ },
+ "records": {
+ "title": "Gacha Records",
+ "date": "Date",
+ "item": "Item"
}
},
"documentation": {
diff --git a/src/main/resources/languages/fr-FR.json b/src/main/resources/languages/fr-FR.json
index d013db579..dd35c37a6 100644
--- a/src/main/resources/languages/fr-FR.json
+++ b/src/main/resources/languages/fr-FR.json
@@ -399,6 +399,11 @@
"available_five_stars": "Objets 5 étoiles disponibles",
"available_four_stars": "Objets 4 étoiles disponibles",
"available_three_stars": "Objets 3 étoiles disponibles"
+ },
+ "records": {
+ "title": "Gacha Records",
+ "date": "Date",
+ "item": "Objet"
}
},
"documentation": {
diff --git a/src/main/resources/languages/pl-PL.json b/src/main/resources/languages/pl-PL.json
index 3dea9591a..7cdde7bae 100644
--- a/src/main/resources/languages/pl-PL.json
+++ b/src/main/resources/languages/pl-PL.json
@@ -315,6 +315,11 @@
"available_five_stars": "Available 5-star Items",
"available_four_stars": "Available 4-star Items",
"available_three_stars": "Available 3-star Items"
+ },
+ "records": {
+ "title": "Gacha Records",
+ "date": "Date",
+ "item": "Item"
}
}
}
\ No newline at end of file
diff --git a/src/main/resources/languages/zh-CN.json b/src/main/resources/languages/zh-CN.json
index 04904ee0a..e14bb367d 100644
--- a/src/main/resources/languages/zh-CN.json
+++ b/src/main/resources/languages/zh-CN.json
@@ -399,6 +399,11 @@
"available_five_stars": "可获得的5星物品",
"available_four_stars": "可获得的4星物品",
"available_three_stars": "可获得的3星物品"
+ },
+ "records": {
+ "title": "祈愿记录",
+ "date": "日期",
+ "item": "物品"
}
},
"documentation": {
diff --git a/src/main/resources/languages/zh-TW.json b/src/main/resources/languages/zh-TW.json
index 318f5c7ba..753725bb7 100644
--- a/src/main/resources/languages/zh-TW.json
+++ b/src/main/resources/languages/zh-TW.json
@@ -399,6 +399,11 @@
"available_five_stars": "可獲得的5星物品",
"available_four_stars": "可獲得的4星物品",
"available_three_stars": "可獲得的3星物品"
+ },
+ "records": {
+ "title": "祈願記錄",
+ "date": "日期",
+ "item": "物品"
}
},
"documentation": {