Skip to content

Commit b883853

Browse files
committed
Update translation script for new languages
1 parent 71af2c5 commit b883853

File tree

1 file changed

+17
-8
lines changed

1 file changed

+17
-8
lines changed

translations/gen_translations.lua

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,24 @@
11
local http_request = require("http.request")
22
local utils = require("./utils")
33

4-
local SHEETS_CSV_URL =
5-
[[https://docs.google.com/spreadsheets/d/1kas1J6RcIePcaRRxtTluPZm8C8kydpaoQBtRg15M-zM/export?format=tsv&gid=1517055494#gid=1517055494]]
4+
local SHEETS_TSV_URL =
5+
[[https://docs.google.com/spreadsheets/d/1kas1J6RcIePcaRRxtTluPZm8C8kydpaoQBtRg15M-zM/export?format=tsv&gid=1517055494#gid=1517055494]]
66

77
local SHEET_LANG_TO_WWFC_LANG = {
88
Japanese = "LangJapanese",
99
English = "LangEnglish",
1010
German = "LangGerman",
1111
-- French = "LangFrench", -- We only have EU French
12-
Spanish = "LangSpanish",
12+
["Spanish(NTSC)"] = "LangSpanish",
1313
Italian = "LangItalian",
1414
Dutch = "LangDutch",
1515
["Chinese (Simplified)"] = "LangSimpChinese",
16-
-- LangTradChinese
16+
["Chinese (Traditional)"] = "LangTradChinese",
1717
Korean = "LangKorean",
1818

1919
-- LangEnglishEU -- We only have American English
2020
French = "LangFrenchEU",
21-
-- LangSpanishEU -- We only have Americas Spanish
21+
["Spanish(EU)"] = "LangSpanishEU",
2222

2323
-- Custom Languages:
2424
Czech = "LangCzech",
@@ -56,10 +56,11 @@ local ORDERED_LANGUAGES = {
5656
"Japanese",
5757
"English",
5858
"German",
59-
"Spanish",
59+
"Spanish(NTSC)",
6060
"Italian",
6161
"Dutch",
6262
"Chinese (Simplified)",
63+
"Chinese (Traditional)",
6364
"Korean",
6465

6566
-- Custom
@@ -72,15 +73,18 @@ local ORDERED_LANGUAGES = {
7273

7374
-- EU
7475
"French",
76+
"Spanish(EU)",
7577
-- Custom
7678
"Portuguese",
7779
}
7880

79-
local headers, stream = assert(http_request.new_from_uri(SHEETS_CSV_URL):go())
81+
print("Downloading sheet as tsv")
82+
local headers, stream = assert(http_request.new_from_uri(SHEETS_TSV_URL):go())
8083
local body = assert(stream:get_body_as_string())
8184
if headers:get(":status") ~= "200" then
8285
error(body)
8386
end
87+
print("Downloaded sheet")
8488

8589
-- local infd = io.open("./WhWz & RR Translation - RR_ Server-Side Text.tsv")
8690
-- assert(infd, "Please download the spreadsheet as 'WhWz & RR Translation - RR_ Server-Side Text.tsv'")
@@ -108,6 +112,7 @@ end
108112

109113
local messages = {}
110114

115+
print("Processing sheet into message objects")
111116
for _, line in ipairs(split) do
112117
local translations = utils.split_by_pattern(line, "\t")
113118
local message = table.remove(translations, 1)
@@ -132,6 +137,7 @@ local output_lines = {
132137
}
133138

134139
for _, message_name in ipairs(ORDERED_MESSAGES) do
140+
print("Adding message " .. message_name)
135141
local message = messages[message_name]
136142
assert(message, "Missing message for " .. message_name)
137143
table.insert(output_lines, string.format("\t%s = WWFCErrorMessage{", message_name))
@@ -141,7 +147,8 @@ for _, message_name in ipairs(ORDERED_MESSAGES) do
141147
for _, lang in ipairs(ORDERED_LANGUAGES) do
142148
local mapped = SHEET_LANG_TO_WWFC_LANG[lang]
143149
local translation = message.langs[lang]
144-
if mapped and translation ~= "" then
150+
if mapped and translation and translation ~= "" then
151+
print((" %s: Present"):format(lang))
145152
table.insert(output_lines, string.format('\t\t\t%s: "" +', mapped))
146153

147154
local splits = utils.split_by_pattern(translation, "+")
@@ -157,6 +164,8 @@ for _, message_name in ipairs(ORDERED_MESSAGES) do
157164

158165
table.insert(output_lines, string.format('\t\t\t\t"%s%s', segment, ending))
159166
end
167+
else
168+
print((" %s: Missing"):format(lang))
160169
end
161170
end
162171

0 commit comments

Comments
 (0)