Translations keyed by labels instead of English text

tr('pnis.delivery_2_to_6_weeks') instead of tr('Delivery: 2 to 6 weeks'): the
English lives once, in src/i18n/en.js (inlined into the page at build, so no
extra request), and it/pt/fr map the same labels. Changing English wording no
longer renames a key in every dictionary.

- 2,899 labels, made from where each text is used and its first words; short
  shared words are common.*
- plurals are one label with {one, other}: trn('label', n)
- static markup: data-i18n="label", data-i18n-aria-label, data-i18n-title
- saves from 1.33 and older stored English text in a few places; tr() still
  resolves it
- i18n-check: undefined/unused labels, markup drift, plural shape; i18n-add.js
  works on labels and --rename updates src/ too
- the old-branch port tool gives old English-keyed code and dictionaries the
  same labels
This commit is contained in:
Frederic Jung 2026-10-27 11:05:09 +01:00
parent d0ba85ef8f
commit e817beed1a
No known key found for this signature in database
94 changed files with 13681 additions and 10633 deletions

View file

@ -1,9 +1,9 @@
function renderHint(){
const hn=$('hint');if(!S||UI.hintOff||(S.tut!==undefined&&S.tut!==null)||(innerWidth<760&&(UI.sel||UI.leftOpen)&&!(UI.drag&&UI.drag.mode==='link'))){hn.hidden=true;return;}
let t='';
if(UI.drag&&UI.drag.mode==='link')t=UI.snap?tr('Release to plan a link'):tr('Drag onto another city');
else if(!S.links.length&&S.done.tr)t=tr('Tip: drag from your pink router to another city to lay fiber');
else if(!S.done.bb)t=tr('Tap your city, then Launch broadband');
if(UI.drag&&UI.drag.mode==='link')t=UI.snap?tr('hint.release_to_plan_a_link'):tr('hint.drag_onto_another_city');
else if(!S.links.length&&S.done.tr)t=tr('hint.tip_drag_from_your_pink_router');
else if(!S.done.bb)t=tr('hint.tap_your_city_then_launch_broadband');
hn.textContent=t;hn.hidden=!t;
}