Show localised names of mod settings in the web UI (#1181)

The mod pack page only looked up mod-setting-name.<name>, so settings
with a localised_name showed the internal name, and rich text tags in
the locale showed up as raw text.

Resolve localised_name and localised_description from the exported
settings prototypes against the exported locale, falling back to the
mod-setting-name/mod-setting-description keys and then the internal
name. The resolver handles parameters, the "" and "?" keys and
__ITEM__/__ENTITY__/__TILE__/__FLUID__ references. Rich text
formatting tags are removed and prototype icons are replaced with
their name.

Fixes #768

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
BastiaanandClaude Opus 5.5 authored and GitHub committed 2026-11-04 18:02:37 +00:00
1 parent c6867de13d
commit 6d9a32d28b
5 files changed
+290 -4

No files matched your search

+3
View File
@@ -21,6 +21,7 @@ describe("web_ui/util/mod_settings", function() {
"first": {
type: "string-setting", name: "first", mod: "a", setting_type: "startup",
default_value: "x", allowed_values: ["x", "y"],
localised_name: ["name.first"], localised_description: ["description.first"],
},
},
"unrelated": { "gone-number": { type: "unrelated", name: "gone-number", setting_type: "startup" } },
@@ -30,6 +31,8 @@ describe("web_ui/util/mod_settings", function() {
const { known, unknown } = modSettingFields(prototypes, "startup", stored);
assert.deepEqual(known.map(field => field.name), ["first", "kept"]);
assert.deepEqual(known[0].allowed_values, ["x", "y"]);
assert.deepEqual(known[0].localised_name, ["name.first"]);
assert.deepEqual(known[0].localised_description, ["description.first"]);
assert.deepEqual(
unknown.map(field => [field.name, field.type]),
[["gone-color", "color-setting"], ["gone-number", "double-setting"], ["gone-string", "string-setting"]],