Show the language of players on their user page

exp_legacy recorded each player's locale in PlayerData statistics
which nothing read. The lua side now sends one ipc event with the
player's locale when they join and when they change language, the
instance forwards it, and the controller stores it on the player
record.

The Scenario section of the user page shows the language by name with
a flag made from regional indicator symbols. Locales with a region use
it directly, the rest map to a country through a small table covering
Factorio's locale list. Arabic, Catalan, Basque, and Esperanto have no
single country and get no flag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
bbassieandClaude Opus 5.5 committed 2026-10-14 22:10:31 +00:00
1 parent 6821d62c10
commit ebe7504c00
17 files changed
+155 -34

No files matched your search

+8 -1
View File
@@ -153,7 +153,7 @@ t.test("instance plugin", t2 => {
t2.end();
});
t.test("join messages", t2 => {
t.test("player settings", t2 => {
const alice = new messages.PlayerRecord("Alice", "Alice has arrived ]=] ]==]");
t2.test("a joining player's message is printed to everyone", async t3 => {
@@ -195,6 +195,13 @@ t.test("join messages", t2 => {
t3.strictSame(sent.map(request => [request.playerName, request.message]), [["Alice", "Hi"], ["Alice", null]]);
});
t2.test("ipc with a locale is forwarded to the controller", async t3 => {
const { ipc, state } = await startPlugin(t3);
await ipc("exp_scenario:locale", { player_name: "Alice", locale: "de" });
const [event] = state.sent.filter(request => request instanceof messages.PlayerLocaleEvent);
t3.strictSame([event.playerName, event.locale], ["Alice", "de"]);
});
t2.test("ipc asking for the message prints it to the player", async t3 => {
const { ipc, setStatus, state } = await startPlugin(t3, [], [alice]);
setStatus("running");