feat(dashboard): every request and page gets game text in the viewer's language

The dashboard loads every language in the client's locale; each request
runs in the viewer's language (Workers::Reply carries it to the worker),
templates get game.* and phrase()/zone_name(), scripts get GameText.* on
<body data-game>, and the user menu picks the game text language.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 22:06:22 -05:00
parent a6fc67a4bb
commit 17b9479c0e
5 changed files with 81 additions and 17 deletions

View File

@@ -4,6 +4,7 @@
#include <exception>
#include <thread>
#include "GameText.h"
#include "RouteUtils.h"
#include "Web.h"
@@ -37,8 +38,10 @@ namespace Workers {
if (ready || !g_Pool.Running()) return fill(reply);
const auto deferred = Web::Defer(reply, context);
const auto path = context.path;
g_Pool.Submit(priority, [deferred, path, fill = std::move(fill)] {
// The worker writes game text in the viewer's language too
g_Pool.Submit(priority, [deferred, path, language = GameText::Language(), fill = std::move(fill)] {
if (deferred.Cancelled()) return;
const GameText::LanguageScope scope(language);
HTTPReply out;
try {
fill(out);