From 9adba2a5d62c52db0f6a95be4e5732ba721a701e Mon Sep 17 00:00:00 2001 From: Yuchenjimmy Date: Mon, 3 Aug 2026 17:14:09 +0000 Subject: [PATCH 1/2] Add map selection localization support and Traditional Chinese translation --- loc/TW/strings_db.lua | 1 + lua/ui/dialogs/mapselect.lua | 36 +++++++++++++++++++++++++++++++++--- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/loc/TW/strings_db.lua b/loc/TW/strings_db.lua index bacbe4c0ced..0edb32788f3 100644 --- a/loc/TW/strings_db.lua +++ b/loc/TW/strings_db.lua @@ -1484,6 +1484,7 @@ SCMP_005_Description="這群島嶼曾經是走私者的天堂,它是以在這 SCMP_006_Description="以早期一位探險者為名的伊昂路口曾經見識過無數的戰役。相當開闊的地區和大量的質量積點導致多年連續不斷的戰爭。" SCMP_007_Description="「空手」是被冰雪包圍的一小長條綠地,沒有人能肯定最早是誰想出這個名字來的。傳說中這裡原是中立地帶,各陣營的士兵都可以前來此地,不用擔心受到攻擊。因此,所有前來此地的人都是「空手」的,表示沒有攜帶武器。" SCMP_008_Description="多年以來,這些冰河一直都由「萬古」進行開採,也是他們取的名字。但是,隨著戰役的進行,「萬古」已經被驅離,冰河將屬於能夠守住這個地方的人所有。" +Setons_Clutch_Name="塞頓之握" SCMP_009_Description="過去幾年中,「塞頓之握」已經發生過數十次戰鬥。有耐心的搜索者可以在地裡和水裡發現數千個部隊的遺物。" SCMP_010_Description="曾有一個名叫「宋」的酋長將這個島嶼視為家。他選擇此地,一方面因為這裡極美,也因為這裡的資源豐富。宋早已被趕走,但是留下的資源等候有能耐的人來開採。" SCMP_011_Description="這裡曾經是一塊小型大陸,UEF在這裡建造一處研究基地,進行先進武器測試。研究人員無法控制一項實驗性武器,造成的爆炸毀了整個大陸,使它成為分散的島嶼。現在三個陣營都試圖尋找這個武器的資料,以便利用。" diff --git a/lua/ui/dialogs/mapselect.lua b/lua/ui/dialogs/mapselect.lua index 7fff9725254..d9f2fc803cd 100644 --- a/lua/ui/dialogs/mapselect.lua +++ b/lua/ui/dialogs/mapselect.lua @@ -962,11 +962,41 @@ function SetupOptionsPanel(parent, curOptions) UIUtil.CreateLobbyVertScrollbar(OptionContainer, -1, -5, -27) end +-- Generate LOC entries for scenario names +function LOCN(str, type) + local name = str + name = name:gsub(' %- ', '_'):gsub('%-', '_'):gsub(':', ''):gsub("'", ''):gsub('%w+ Mission %d+ ', ''):gsub(' ', '_') + if string.find(str, ''..str) + elseif type == 'skirmish' then + return LOC(''..str) + else + return str + end +end + +-- Generate LOC entries for scenario descriptions +function LOCD(str1, str2, type) + local name = str1 + name = name:gsub(' %- ', '_'):gsub('%-', '_'):gsub(':', ''):gsub("'", ''):gsub('%w+ Mission %d+ ', ''):gsub(' ', '_') + if string.find(str2, ''..str2) + elseif type == 'skirmish' then + return LOC(''..str2) + else + return str2 + end +end + function SetDescription(scen) local errors = false description:DeleteAllItems() if scen.name then - description:AddItem(scen.name) + description:AddItem(LOCN(scen.name, scen.type)) else description:AddItem(LOC("No Scenario Name")) errors = true @@ -998,7 +1028,7 @@ function SetDescription(scen) description:AddItem("") if scen.description then local textBoxWidth = description.Width() - local wrapped = import("/lua/maui/text.lua").WrapText(LOC(scen.description), textBoxWidth, + local wrapped = import("/lua/maui/text.lua").WrapText(LOCD(scen.name, scen.description, scen.type), textBoxWidth, function(curText) return description:GetStringAdvance(curText) end) for i, line in wrapped do description:AddItem(line) @@ -1050,7 +1080,7 @@ function PopulateMapList() reselectRow = count end count = count + 1 - mapList:AddItem(LOC(sceninfo.name)) + mapList:AddItem(LOCN(sceninfo.name, sceninfo.type)) end end From ee6bf698dfab6cbe38229a2b305162bb875ea21e Mon Sep 17 00:00:00 2001 From: Yuchenjimmy Date: Tue, 4 Aug 2026 15:20:03 +0000 Subject: [PATCH 2/2] Add changelog snippet --- changelog/snippets/other.7201.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog/snippets/other.7201.md diff --git a/changelog/snippets/other.7201.md b/changelog/snippets/other.7201.md new file mode 100644 index 00000000000..ca3db6a1dd5 --- /dev/null +++ b/changelog/snippets/other.7201.md @@ -0,0 +1 @@ +- Add localization support for scenario names and descriptions in map selection (#7201).