fix(tijdzones): ververs landnamen en zoeken bij taalwissel
This commit is contained in:
parent
7a6722e2d0
commit
5ac55eaf7c
2 changed files with 23 additions and 1 deletions
|
|
@ -3642,7 +3642,7 @@ function app() {
|
|||
},
|
||||
async loadLangs() { try { const d = await fetch('/api/i18n').then(r=>r.json()); this.languages = d.languages || []; } catch(e) {} },
|
||||
async loadLang(code) { try { const d = await fetch('/api/i18n/'+code).then(r=>r.json()); this.T = d.strings || {}; } catch(e) {} },
|
||||
setLang(c) { localStorage.setItem('lang', c); this.loadLang(c); },
|
||||
setLang(c) { localStorage.setItem('lang', c); this._tzLanden = {}; this.loadLang(c); },
|
||||
|
||||
async openLangEditor(code) {
|
||||
const ref = await this.rpc('/api/i18n/keys');
|
||||
|
|
|
|||
|
|
@ -839,6 +839,28 @@ check('balk staat halverwege', c.job.progress.pct === 50);
|
|||
check('stad die zo begint eerst', c.tzLijst()[0].id === 'Europe/Lisbon');
|
||||
c.tzKiezer.q = 'nederland';
|
||||
check('zoeken op land in het Nederlands', c.tzLijst().some(z => z.id === 'Europe/Amsterdam'));
|
||||
// Een taalwissel zonder herladen moet ook reeds opgezochte landen vertalen.
|
||||
const bewaardeOpslag = global.localStorage;
|
||||
const taalWaarden = new Map([['lang', 'nl']]);
|
||||
global.localStorage = {getItem: k => taalWaarden.get(k) || null,
|
||||
setItem: (k, v) => taalWaarden.set(k, v)};
|
||||
try {
|
||||
const taalApp = app();
|
||||
taalApp.loadLang = async () => {};
|
||||
taalApp.tzData = echteZones;
|
||||
taalApp.tzKiezer = {open:true, q:'nederland', dichtbij:[], huidig:'UTC'};
|
||||
check('tijdzonekiezer begint met Nederlands land', taalApp.tzLand('NL') === 'Nederland');
|
||||
taalApp.setLang('en');
|
||||
check('tijdzonekiezer vertaalt een eerder opgezocht land na taalwissel',
|
||||
taalApp.tzLand('NL') === 'Netherlands');
|
||||
taalApp.tzKiezer.q = 'netherlands';
|
||||
check('zoeken op de nieuwe landnaam werkt na taalwissel',
|
||||
taalApp.tzLijst().some(z => z.id === 'Europe/Amsterdam'));
|
||||
taalApp.setLang('nl');
|
||||
check('terugwisselen vertaalt de landnaam opnieuw', taalApp.tzLand('NL') === 'Nederland');
|
||||
} finally {
|
||||
global.localStorage = bewaardeOpslag;
|
||||
}
|
||||
c.tzKiezer.q = 'utc';
|
||||
check('UTC is te kiezen hoewel zone.tab hem niet kent', c.tzLijst().some(z => z.id === 'UTC'));
|
||||
c.tzKiezer.q = 'new york';
|
||||
|
|
|
|||
Loading…
Reference in a new issue