mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
i18n: plural forms and contexts the catalogs could only work around
The last translation review left four kinds of problem it could only
reword around in the catalogs. They are fixed in the code now, and the
catalogs go back to natural wording.
- Counts shown with plain t() are tn() plurals: the wildlife count, the
Data Library "Showing {shown} of {total}", the News time window (which
offers 1 h) and the GhostMaps event age (which offers 1 day). The
English keys stay; the catalogs get real forms, as in "Última 1 h" and
"Últimas 24 h", or "1 Tag" and "7 Tage".
- The bridge radar range and ring spacing are tn() plurals too. The
spacing is fractional at the short ranges, and Intl.PluralRules gives
0.75 and 1.5 their own form: ru "0,75 МОР. МИЛИ", "12 МОР. МИЛЬ".
- Street level no longer passes "the view centre" or "this spot" as
{place}: each case has a message of its own, so a preposition no
longer meets a phrase in the wrong case. The progress line had the
same leak and showed the English phrase.
- Latest, FOCUS, CONFIRMED and "{label} · COURSE {heading}°" are split
with a context where one key served two places: the News heading, the
orbital site status, the Wildlife chip and a ship's course.
"CURRENTLY OVER" ended in a preposition that a country name in the
nominative cannot follow in uk, de, it and pt. It reads "under the
satellite" there now, as ru already did.
I18N.md gains the two rules behind these fixes.
This commit is contained in:
1 parent
42540ad85e
commit
209b135ff1
37 files changed
+1124
-196
No files matched your search
@@ -542,7 +542,7 @@ test('retention never revives an incumbent card after the observation window exp
|
||||
test('all heights and the sampled fallback use the same sightings-in-view count label', () => {
|
||||
const h = harness();
|
||||
h.state.renderedRows = [sighting];
|
||||
assert.equal(h.layer.getStats().countLabel, '1 sightings in view');
|
||||
assert.equal(h.layer.getStats().countLabel, '1 sighting in view');
|
||||
h.state.sightingCount = 2000;
|
||||
assert.equal(h.layer.getStats().count, 2000);
|
||||
assert.equal(
|
||||
@@ -560,6 +560,32 @@ test('all heights and the sampled fallback use the same sightings-in-view count
|
||||
}
|
||||
});
|
||||
|
||||
test('the sightings count takes the plural form of its number', (t) => {
|
||||
t.after(() => setLocale('en'));
|
||||
const h = harness();
|
||||
const label = (count) => {
|
||||
h.state.sightingCount = count;
|
||||
return h.layer.getStats().countLabel;
|
||||
};
|
||||
setLocale('ru');
|
||||
assert.equal(label(1), '1 наблюдение в кадре');
|
||||
assert.equal(label(3), '3 наблюдения в кадре');
|
||||
assert.equal(label(5), '5 наблюдений в кадре');
|
||||
setLocale('de');
|
||||
assert.equal(label(1), '1 Beobachtung im Bild');
|
||||
assert.equal(label(2000), '2.000 Beobachtungen im Bild');
|
||||
});
|
||||
|
||||
test('the CONFIRMED chip names the sightings, apart from a confirmed launch landing', (t) => {
|
||||
t.after(() => setLocale('en'));
|
||||
const h = harness();
|
||||
assert.equal(h.chip('quality-confirmed').label, 'CONFIRMED');
|
||||
setLocale('sv');
|
||||
assert.equal(h.chip('quality-confirmed').label, 'BEKRÄFTADE');
|
||||
setLocale('es');
|
||||
assert.equal(h.chip('quality-confirmed').label, 'CONFIRMADAS');
|
||||
});
|
||||
|
||||
test('a stale fallback with a failed-refresh deadline remains DEGRADED, retryable and dated to the cached data', async () => {
|
||||
const h = harness({
|
||||
getSnapshotDetail: async () => ({
|
||||
|
||||
+9
-5
@@ -1,4 +1,4 @@
|
||||
import { t, formatNumber, translateKnown } from '../../i18n/index.js';
|
||||
import { t, tn, formatNumber, translateKnown } from '../../i18n/index.js';
|
||||
import { msg } from '../../i18n/marker.js';
|
||||
import { translateFeedError } from '../../ui/statusText.js';
|
||||
import { wildlifeIconicGroup } from './model.js';
|
||||
@@ -137,7 +137,8 @@ export function createControls({ state, services, parts }) {
|
||||
const chips = [
|
||||
chip({
|
||||
id: WILDLIFE_CONFIRMED_CHIP_ID,
|
||||
label: t('CONFIRMED'),
|
||||
// The sightings, plural; a launch landing is CONFIRMED alone.
|
||||
label: t('CONFIRMED', { context: 'sightings filter' }),
|
||||
title: t('Show only community-confirmed (research-grade) sightings'),
|
||||
params: {
|
||||
confirmed: confirmedFailed ? state.confirmed : !state.confirmed,
|
||||
@@ -214,9 +215,12 @@ export function createControls({ state, services, parts }) {
|
||||
stale: state.stale,
|
||||
loading,
|
||||
refreshing,
|
||||
countLabel: t('{count} sightings in view', {
|
||||
count: formatNumber(count),
|
||||
}),
|
||||
countLabel: tn(
|
||||
count,
|
||||
'{count} sighting in view',
|
||||
'{count} sightings in view',
|
||||
{ count: formatNumber(count) },
|
||||
),
|
||||
loadingLabel: loading
|
||||
? t('loading...')
|
||||
: refreshing
|
||||
|
||||
@@ -1987,7 +1987,7 @@ test('unavailable grids fail closed to visible sampled sprites without a global
|
||||
assert.equal(h.clicks.collection.values[0].id, 'wildlife:inat:1');
|
||||
assert.ok(h.clicks.collection.values[0].width * 0.5 >= 8);
|
||||
assert.equal(h.layer.getStats().count, 1);
|
||||
assert.match(h.layer.getStats().countLabel, /sightings in view/);
|
||||
assert.equal(h.layer.getStats().countLabel, '1 sighting in view');
|
||||
assert.equal(h.layer.getStats().partial, undefined);
|
||||
assert.equal(layerFeedState(h.layer.getStats()), 'degraded');
|
||||
assert.match(h.layer.getStats().error, /Malformed iNaturalist grid response/);
|
||||
@@ -2024,7 +2024,7 @@ test('an oversized view coarsens to a complete grid within the six-tile cap', as
|
||||
await h.update();
|
||||
assert.equal(h.clicks.collection.values.length, 1);
|
||||
assert.equal(h.clicks.collection.values[0].id, 'wildlife:inat:1');
|
||||
assert.match(h.layer.getStats().countLabel, /sightings in view/);
|
||||
assert.match(h.layer.getStats().countLabel, /sightings? in view/);
|
||||
assert.equal(layerFeedState(h.layer.getStats()), 'nominal');
|
||||
h.layer.destroy();
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user