Merge #174: Spanish translation (JMF-Alex)

Resolved CHANGELOG and README against main, translated the 26 labels added
since the PR branched, and added Spanish to the peering language loop.
This commit is contained in:
Frederic Jung 2026-10-27 20:31:19 +01:00
commit 0510df1816
No known key found for this signature in database
9 changed files with 2942 additions and 7 deletions

View file

@ -9,6 +9,7 @@ All notable changes to this project are documented here. The project follows
- Sponsor a conference: some peering meetings sell sponsorships, and while the glow lasts more customers from that region come knocking (#168).
- Capacity conferences arrive: PTC in Honolulu and Capacity Europe in London, once a year from customer level 3. Attend, and carriers ask for huge deals (waves, subsea capacity, whole fiber pairs) that you sign first and build afterwards, with months to deliver and a penalty if you miss the date (#168).
- Big POPs can now run up to 16 routers (#157). The standard cage still holds six: each router past that costs half again to install and adds rent for a cage extension.
- Series of Tubes now speaks Spanish. The game follows your browser's language the first time, and you can switch to Spanish under Settings or on the title screen.
## [1.34.1] — 2026-10-27

View file

@ -45,7 +45,7 @@ npm run dev # http://localhost:8080
Progress is saved in your browser's local storage.
The game speaks English, Italian, Portuguese and French. It follows your browser's language the first time
The game speaks English, Italian, Portuguese, French and Spanish. It follows your browser's language the first time
and remembers the one you pick under Settings or on the title screen.
## Development

View file

@ -56,7 +56,7 @@ Development runs on `npm run dev` (assembles on every request, reloads on save);
| Path | What it is |
| --- | --- |
| `src/i18n/en.js` | English: label → text, one entry per line, sorted; inlined into the page by `<!-- @include i18n -->` |
| `site/i18n/it.js`, `pt.js`, `fr.js` | Translations: label → text, the same layout; loaded only for that language |
| `site/i18n/it.js`, `pt.js`, `fr.js`, `es.js` | Translations: label → text, the same layout; loaded only for that language |
| `site/sw.js` | Service worker: network-first for pages, stale-while-revalidate for assets. Cache name is stamped with the version |
| `site/site.webmanifest`, icons, `404.html`, `CNAME`, `robots.txt`, `sitemap.xml`, `llms.txt` | PWA and GitHub Pages files, copied as they are |
| `scripts/lib/page.js` | Assembles the page from `src/` (also from a git ref with `--ref`, for performance baselines) |

2929
site/i18n/es.js Normal file

File diff suppressed because it is too large Load diff

View file

@ -2,7 +2,7 @@
The page always comes from the network when there is one, so a new release shows up on the
next visit; everything else is served from the cache and refreshed in the background. */
const CACHE = 'sot-__VERSION__';
const CORE = ['/', '/index.html', '/site.webmanifest', '/favicon.svg', '/icon-192.png', '/icon-512.png', '/apple-touch-icon.png', '/i18n/it.js?v=__VERSION__', '/i18n/pt.js?v=__VERSION__', '/i18n/fr.js?v=__VERSION__'];
const CORE = ['/', '/index.html', '/site.webmanifest', '/favicon.svg', '/icon-192.png', '/icon-512.png', '/apple-touch-icon.png', '/i18n/it.js?v=__VERSION__', '/i18n/pt.js?v=__VERSION__', '/i18n/fr.js?v=__VERSION__', '/i18n/es.js?v=__VERSION__'];
self.addEventListener('install', (e) => {
e.waitUntil(caches.open(CACHE).then((c) => c.addAll(CORE)).then(() => self.skipWaiting()));

View file

@ -154,7 +154,7 @@
<script>
// Language: the player's saved choice, else the browser's, else English. Non-English dictionaries load before the game.
(function(){const langs=window.SOT_LANGS={en:'English',it:'Italiano',pt:'Português',fr:'Français'};let l=null;try{l=localStorage.getItem('sot-lang');}catch(e){}
(function(){const langs=window.SOT_LANGS={en:'English',it:'Italiano',pt:'Português',fr:'Français',es:'Español'};let l=null;try{l=localStorage.getItem('sot-lang');}catch(e){}
const b=(navigator.language||'').slice(0,2).toLowerCase();if(!Object.hasOwn(langs,l))l=Object.hasOwn(langs,b)?b:'en';
window.SOT_LANG=l;document.documentElement.lang=l;if(l!=='en')document.write('<script src="i18n/'+l+'.js?v=__VERSION__"><\/script>');})();
</script>

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()');

View file

@ -43,7 +43,7 @@ test('Rackstar serves cacheable Crowdflare traffic locally and overflow uses tra
});
test('Rackstar boxes survive save migration and appear on phone peering panels in every language', () => {
for (const lang of ['en', 'it', 'pt', 'fr']) {
for (const lang of ['en', 'it', 'pt', 'fr', 'es']) {
const { dom, ev, errors } = load(lang === 'en' ? {} : { lang });
setup(ev);
ev('window.matchMedia=()=>({matches:true})');