mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-18 01:02:23 +00:00
i18n: follow-up to the review of the plural and context fixes
- The street-level plan step names its place the way show_street_level reads its arguments: a pointed or numbered thing has no place yet, and "this spot" needs both coordinates. - The view-centre error message is removed: the Street Level layer always gives its own translated text for an empty search, so it never showed. "the view centre" is one exported constant for both voice modules. - The orbital site status uses the word of the FOCUS card in es, fr, it, pt and he, and the Wildlife chip agrees with "avistamientos" and "avvistamenti". - CURRENTLY OVER is the noun for an overflight in de, uk, it and pt, shorter than before, so the place name keeps its room on a phone. - The glossaries record the new terms; I18N.md words two rules more exactly.
This commit is contained in:
1 parent
3953421aad
commit
69fa1bf222
30 files changed
+80
-75
No files matched your search
@@ -5,7 +5,11 @@ import {
|
||||
feedProvenanceEnvelope,
|
||||
} from '../data/layerSnapshot.js';
|
||||
import { readLayerLifecycleSummary } from './layerSummary.js';
|
||||
import { SPEECH_BUILDERS, attachVoiceResult } from './speech.js';
|
||||
import {
|
||||
SPEECH_BUILDERS,
|
||||
VIEW_CENTRE_LABEL,
|
||||
attachVoiceResult,
|
||||
} from './speech.js';
|
||||
import { resolveDeicticArgs } from './deixis.js';
|
||||
export { readLayerLifecycleSummary } from './layerSummary.js';
|
||||
import { defaultGeospatial } from '../search/defaults.js';
|
||||
@@ -3917,13 +3921,11 @@ async function requestStreetLevel(
|
||||
};
|
||||
|
||||
// Then the place: a name that geocodes to nothing changes nothing else.
|
||||
// "the view centre" is English for the model; the card (speech.js) gives
|
||||
// it messages of its own, since it is a phrase and not a place name.
|
||||
label =
|
||||
query ||
|
||||
(entity ? String(entity.label || entity.id) : '') ||
|
||||
(hasCoordinates ? `${latitude.toFixed(4)}, ${longitude.toFixed(4)}` : '') ||
|
||||
'the view centre';
|
||||
VIEW_CENTRE_LABEL;
|
||||
atViewCentre = !query && !hasCoordinates && !entity;
|
||||
let point = null;
|
||||
let location = null;
|
||||
|
||||
+10
-15
@@ -332,16 +332,6 @@ const ERROR_PATTERNS = [
|
||||
place: localizePlaceName(place),
|
||||
}),
|
||||
],
|
||||
// show_street_level names no place when it looks at the view centre. The
|
||||
// phrase is not a name: it has a message of its own, so each language
|
||||
// words it in the case its preposition asks for.
|
||||
[
|
||||
/^No (.+) imagery near the view centre$/,
|
||||
([, source]) =>
|
||||
t('No {source} imagery near the view centre', {
|
||||
source: translateKnown(source),
|
||||
}),
|
||||
],
|
||||
[
|
||||
/^No (.+) imagery near (.+)$/,
|
||||
([, source, place]) =>
|
||||
@@ -1122,15 +1112,20 @@ export function planStepLabel(name, args = {}) {
|
||||
}
|
||||
case 'show_street_level': {
|
||||
const source = STREET_LEVEL_SOURCE_NAMES[args.provider];
|
||||
const query = String(args.query || '').trim();
|
||||
// A pointed or numbered thing is found later (deixis): no place yet.
|
||||
if (query.toLowerCase() === 'pointer' || args.referent != null)
|
||||
return source || t('Street Level');
|
||||
// "This spot" and "the view centre" are phrases, not place names:
|
||||
// each is a message of its own, worded in the grammar of the language.
|
||||
if (args.query) {
|
||||
const place = shownPlace(args.query, 32);
|
||||
if (query) {
|
||||
const place = shownPlace(query, 32);
|
||||
return source
|
||||
? t('{source} at {place}', { source, place })
|
||||
: t('Street level at {place}', { place });
|
||||
}
|
||||
if (args.latitude != null)
|
||||
// Coordinates count only as a pair, as show_street_level reads them.
|
||||
if (args.latitude != null && args.longitude != null)
|
||||
return source
|
||||
? t('{source} at this spot', { source })
|
||||
: t('Street level at this spot');
|
||||
@@ -1212,8 +1207,8 @@ export function narrationLabel(name, args = {}) {
|
||||
}
|
||||
}
|
||||
|
||||
/** The place show_street_level reports when it names none (gevActions). */
|
||||
const VIEW_CENTRE_LABEL = 'the view centre';
|
||||
/** The place show_street_level reports when it names none. */
|
||||
export const VIEW_CENTRE_LABEL = 'the view centre';
|
||||
|
||||
/** On-screen labels for progress steps. */
|
||||
const STEP_LABELS = Object.freeze({
|
||||
|
||||
+26
-25
@@ -7,6 +7,7 @@ import {
|
||||
progressLine,
|
||||
progressStepLabel,
|
||||
spokenLabel,
|
||||
VIEW_CENTRE_LABEL,
|
||||
} from './speech.js';
|
||||
import { presentResult } from './resultDisplay.js';
|
||||
import { countWords, findHedges } from './speechLint.js';
|
||||
@@ -795,35 +796,35 @@ test('the street-level card words "the view centre" and "this spot" as phrases,
|
||||
planStepLabel('show_street_level', { query: 'Alexanderplatz', provider: 'kartaview' }),
|
||||
'KartaView: Alexanderplatz',
|
||||
);
|
||||
const empty = envelope('show_street_level', {
|
||||
ok: false,
|
||||
stage: 'imagery',
|
||||
noImagery: true,
|
||||
atViewCentre: true,
|
||||
label: 'the view centre',
|
||||
providerName: 'Mapillary',
|
||||
error: 'No Mapillary imagery near the view centre',
|
||||
});
|
||||
assert.deepEqual(empty.display.lines, [
|
||||
'Keine Bilder von Mapillary in der Nähe der Bildmitte',
|
||||
]);
|
||||
assert.equal(empty.say, 'No Mapillary imagery near the view centre.');
|
||||
const named = envelope('show_street_level', {
|
||||
ok: false,
|
||||
stage: 'imagery',
|
||||
noImagery: true,
|
||||
label: 'Alexanderplatz',
|
||||
providerName: 'Mapillary',
|
||||
error: 'No Mapillary imagery near Alexanderplatz',
|
||||
});
|
||||
assert.deepEqual(named.display.lines, [
|
||||
'Keine Bilder von Mapillary in der Nähe von Alexanderplatz',
|
||||
]);
|
||||
assert.equal(
|
||||
progressStepLabel('imagery', 'the view centre'),
|
||||
progressStepLabel('imagery', VIEW_CENTRE_LABEL),
|
||||
`${t('Opening imagery')}: die Bildmitte`,
|
||||
);
|
||||
} finally {
|
||||
setLocale('en');
|
||||
}
|
||||
});
|
||||
|
||||
test('the street-level plan step names the place as show_street_level finds it', () => {
|
||||
// A pointed or numbered thing is located later, by deixis.
|
||||
assert.equal(planStepLabel('show_street_level', { referent: 2 }), 'Street Level');
|
||||
assert.equal(
|
||||
planStepLabel('show_street_level', { referent: 2, provider: 'mapillary' }),
|
||||
'Mapillary',
|
||||
);
|
||||
assert.equal(planStepLabel('show_street_level', { query: ' Pointer ' }), 'Street Level');
|
||||
// One coordinate alone is no spot: the action looks at the view centre.
|
||||
assert.equal(
|
||||
planStepLabel('show_street_level', { latitude: 10 }),
|
||||
'Street level at the view centre',
|
||||
);
|
||||
setLocale('de');
|
||||
try {
|
||||
assert.equal(
|
||||
planStepLabel('show_street_level', { referent: 1 }),
|
||||
'Straßenebene',
|
||||
);
|
||||
} finally {
|
||||
setLocale('en');
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user