feat: Spanish translation

This commit is contained in:
JMF-Alex 2026-10-27 16:31:58 +01:00
parent 97b195dd91
commit 288c78e9a0
8 changed files with 2917 additions and 6 deletions

View file

@ -62,6 +62,7 @@ test('the game starts in English unless the player or the browser asks for anoth
assert.equal(load({ navigatorLanguage: 'it-IT' }).ev('SOT_LANG'), 'it', 'an Italian browser asks for Italian');
assert.equal(load({ navigatorLanguage: 'pt-BR' }).ev('SOT_LANG'), 'pt', 'a Brazilian browser asks for Portuguese');
assert.equal(load({ navigatorLanguage: 'fr-FR' }).ev('SOT_LANG'), 'fr', 'a French browser asks for French');
assert.equal(load({ navigatorLanguage: 'es-ES' }).ev('SOT_LANG'), 'es', 'a Spanish browser asks for Spanish');
const it = load({ lang: 'it' });
assert.equal(it.ev('LANG'), 'it');
assert.equal(it.ev('document.documentElement.lang'), 'it');
@ -132,7 +133,7 @@ test('a scenario started in English shows its Italian name after switching', ()
assert.ok(ev("document.getElementById('hAsn').textContent").includes(name));
});
for (const lang of ['en', 'it', 'pt', 'fr']) {
for (const lang of ['en', 'it', 'pt', 'fr', 'es']) {
test(`${lang}: every screen, failure and event renders without errors or unfilled placeholders`, () => {
const { ev, errors } = load(lang === 'en' ? {} : { lang });
seed(ev, 3);
@ -145,6 +146,10 @@ for (const lang of ['en', 'it', 'pt', 'fr']) {
// short enough to stay on one line in the phone's top bar (Caisse · Banque wrapped and cut off the monthly line)
assert.equal(ev("document.querySelector('#hud [data-act=bank] .lbl').textContent"), 'Cash · Banque');
}
if (lang === 'es') {
assert.match(ev("document.getElementById('modalCard').textContent"), /Cómo jugar/);
assert.equal(ev("document.querySelector('#hud [data-act=bank] .lbl').textContent"), 'Caja · Banco');
}
const { thrown, leaks } = tour(ev);
assert.ok(ev('(S.stats.f||{}).anchor'), 'Baltic and Red Sea anchors count for the badge in every language');
assert.deepEqual(thrown, []);

View file

@ -390,7 +390,7 @@ test('DKNOG in Copenhagen is on the conference calendar', () => {
});
test('the Signal group is linked from the title screen, the menu and How to play, in every language', () => {
for (const lang of ['en', 'it', 'pt', 'fr']) {
for (const lang of ['en', 'it', 'pt', 'fr', 'es']) {
const { ev, errors } = load(lang === 'en' ? {} : { lang });
const links = (setup) => ev(`(()=>{${setup};return [...document.querySelectorAll('#modal a[href^="https://signal.group/#"]')].map(a=>a.target+'|'+a.rel+'|'+a.textContent.trim()).join('\\n');})()`);
const title = links('showTitle()');