Add German translation
Series of Tubes now speaks German. site/i18n/de.js translates all 3,063 labels in informal "du". Networking terms that German engineers say in English stay English (Peering, Transit, Dark Fiber, Wave, Port, POP, IX, Route Server, LAG, PNI and so on); plain "fiber" is "Glasfaser" and "fiber pair" is "Faserpaar". RouteScript syntax stays English, as in the other languages. German is registered in the language list and the offline cache, so a German browser starts in German. Every per-language test now covers it, and the German style notes are in the add-strings skill and in the dictionary header.
This commit is contained in:
parent
8e36b22351
commit
1a0a70e575
13 changed files with 3099 additions and 10 deletions
|
|
@ -68,6 +68,14 @@ Natural, friendly Italian, informal "tu". Keep networking terms that Italian eng
|
|||
use in English (peering, transit, router, POP, PNI, LAG, dark fiber). Translate puns
|
||||
into an Italian joke when one fits; otherwise keep the pun name and translate the rest.
|
||||
|
||||
## German style
|
||||
|
||||
Natural, friendly German, informal "du". Networking terms that German engineers say in English stay
|
||||
English (Peering, Transit, Dark Fiber, Wave, Port, Router, POP, IX, Exchange, Backbone, Link, Traffic,
|
||||
Route Server, Line System, Eyeballs, LAG, PNI, Fabric, Scrubbing), but plain "fiber" is "Glasfaser" and
|
||||
"fiber pair" is "Faserpaar". "/mo" is "/Monat", "{n}d" is "{n} T.", money keeps the game's `$100k` style,
|
||||
quotes are „…“. Translate puns into a German joke when one fits; otherwise keep the pun name.
|
||||
|
||||
## Check
|
||||
|
||||
```bash
|
||||
|
|
|
|||
|
|
@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows
|
|||
|
||||
## [Unreleased]
|
||||
|
||||
- Series of Tubes now speaks German. The game follows your browser's language the first time, and you can switch to German under Settings or on the title screen. Networking terms like Peering and Transit stay in English, the way network engineers say them.
|
||||
|
||||
## [1.36.0] — 2026-10-28
|
||||
|
||||
- You can put a link on standby, so one of two links between the same cities sits idle as a backup (#122). It carries traffic only when the other links are full or down, so its capacity is never wasted, and the map draws it dashed while it waits. The routing metric still applies to every link between the two cities.
|
||||
|
|
|
|||
|
|
@ -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, French and Spanish. It follows your browser's language the first time
|
||||
The game speaks English, Italian, Portuguese, French, Spanish and German. It follows your browser's language the first time
|
||||
and remembers the one you pick under Settings or on the title screen.
|
||||
|
||||
## Development
|
||||
|
|
|
|||
|
|
@ -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`, `es.js` | Translations: label → text, the same layout; loaded only for that language |
|
||||
| `site/i18n/it.js`, `pt.js`, `fr.js`, `es.js`, `de.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) |
|
||||
|
|
|
|||
3069
site/i18n/de.js
Normal file
3069
site/i18n/de.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -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__', '/i18n/es.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__', '/i18n/de.js?v=__VERSION__'];
|
||||
|
||||
self.addEventListener('install', (e) => {
|
||||
e.waitUntil(caches.open(CACHE).then((c) => c.addAll(CORE)).then(() => self.skipWaiting()));
|
||||
|
|
|
|||
|
|
@ -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',es:'Español'};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',de:'Deutsch'};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>
|
||||
|
|
|
|||
|
|
@ -46,7 +46,7 @@ test('a home that cannot work is refused, and the game falls back to Frankfurt',
|
|||
});
|
||||
|
||||
test('the sixth tile works on a phone and in every language', () => {
|
||||
for (const lang of ['en', 'it', 'pt', 'fr', 'es']) {
|
||||
for (const lang of ['en', 'it', 'pt', 'fr', 'es', 'de']) {
|
||||
const { ev, errors } = load(lang === 'en' ? {} : { lang });
|
||||
ev('window.innerWidth=360;showTitle()');
|
||||
assert.equal(ev("document.querySelector('label.start.own b').textContent"), ev("tr('title.anywhere_else')"), lang);
|
||||
|
|
|
|||
|
|
@ -63,6 +63,8 @@ test('the game starts in English unless the player or the browser asks for anoth
|
|||
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');
|
||||
assert.equal(load({ navigatorLanguage: 'de-DE' }).ev('SOT_LANG'), 'de', 'a German browser asks for German');
|
||||
assert.equal(load({ navigatorLanguage: 'de-CH' }).ev('SOT_LANG'), 'de', 'so does a Swiss German one');
|
||||
const it = load({ lang: 'it' });
|
||||
assert.equal(it.ev('LANG'), 'it');
|
||||
assert.equal(it.ev('document.documentElement.lang'), 'it');
|
||||
|
|
@ -134,7 +136,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', 'es']) {
|
||||
for (const lang of ['en', 'it', 'pt', 'fr', 'es', 'de']) {
|
||||
test(`${lang}: every screen, failure and event renders without errors or unfilled placeholders`, () => {
|
||||
const { ev, errors } = load(lang === 'en' ? {} : { lang });
|
||||
seed(ev, 3);
|
||||
|
|
@ -151,6 +153,14 @@ for (const lang of ['en', 'it', 'pt', 'fr', 'es']) {
|
|||
assert.match(ev("document.getElementById('modalCard').textContent"), /Cómo jugar/);
|
||||
assert.equal(ev("document.querySelector('#hud [data-act=bank] .lbl').textContent"), 'Caja · Banco');
|
||||
}
|
||||
if (lang === 'de') {
|
||||
assert.match(ev("document.getElementById('modalCard').textContent"), /Spielanleitung/);
|
||||
assert.equal(ev("document.querySelector('#hud [data-act=bank] .lbl').textContent"), 'Kasse · Bank');
|
||||
// networking jargon stays English in German (Peering, Dark Fiber); plain "fiber" is Glasfaser
|
||||
assert.equal(ev("tr('common.peering')"), 'Peering');
|
||||
assert.equal(ev("tr('common.dark_fiber')"), 'Dark Fiber');
|
||||
assert.equal(ev("tr('common.terrestrial_fiber')"), 'Terrestrische Glasfaser');
|
||||
}
|
||||
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, []);
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@ const pick = (ev, id) => JSON.parse(ev(`(()=>{const s=document.getElementById('$
|
|||
opts:[...s.options].map(o=>[o.value,o.textContent,o.lang]),label:(document.querySelector('label[for=${id}]')||{}).textContent});})()`));
|
||||
|
||||
test('language is one dropdown on the title screen and in Settings, in every language, with the current one selected', () => {
|
||||
for (const lang of ['en', 'it', 'pt', 'fr', 'es']) {
|
||||
for (const lang of ['en', 'it', 'pt', 'fr', 'es', 'de']) {
|
||||
const { ev, errors } = load(lang === 'en' ? {} : { lang });
|
||||
const langs = JSON.parse(ev('JSON.stringify(Object.entries(LANGS))'));
|
||||
const title = pick(ev, 'langTitle');
|
||||
|
|
|
|||
|
|
@ -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', 'es']) {
|
||||
for (const lang of ['en', 'it', 'pt', 'fr', 'es', 'de']) {
|
||||
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()');
|
||||
|
|
|
|||
|
|
@ -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', 'es']) {
|
||||
for (const lang of ['en', 'it', 'pt', 'fr', 'es', 'de']) {
|
||||
const { dom, ev, errors } = load(lang === 'en' ? {} : { lang });
|
||||
setup(ev);
|
||||
ev('window.matchMedia=()=>({matches:true})');
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ const { load } = require('./harness');
|
|||
const ISSUES = 'https://github.com/fjaeckel/seriesoftubes/issues/new/choose';
|
||||
|
||||
test('bugs and ideas point to GitHub from the menu and How to play, and the chat no longer asks for bug reports', () => {
|
||||
for (const lang of ['en', 'it', 'pt', 'fr', 'es']) {
|
||||
for (const lang of ['en', 'it', 'pt', 'fr', 'es', 'de']) {
|
||||
const { ev, errors } = load(lang === 'en' ? {} : { lang });
|
||||
ev('ACT.start({})');
|
||||
for (const [where, setup] of [['menu', 'ACT.menu()'], ['help', 'showHelp()']]) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue