Street Level: the action's failure cards in the interface language

The voice card showed English for show_street_level failures the catalog
did not know: a missing key, a map or source that could not be switched on,
the layer, invalid coordinates, an imagery fallback and the filter clause.
They now translate like the other action errors (exact messages and
patterns in speech.js), in all twelve languages; the spoken line stays
English, and the filter clause names the filters as their chips do.
This commit is contained in:
German Khokhlov committed 2026-11-11 13:46:10 +04:00
1 parent e0fedc13dd
commit 8334262109
14 files changed
+322 -12

No files matched your search

+49
View File
@@ -552,6 +552,55 @@ test('the street-level card says "the view centre" in the interface language', (
}
});
test('street-level failure cards are in the interface language; speech stays English', () => {
setLocale('de');
try {
const card = (error, extra = {}) =>
envelope('show_street_level', {
ok: false,
action: 'show_street_level',
providerName: 'Google Street View',
label: 'Paris',
error,
...extra,
});
const lines = (error, extra) => card(error, extra).display.lines;
assert.deepEqual(lines('Google Street View needs its key', { stage: 'key' }), [
'Google Street View braucht seinen Schlüssel',
]);
assert.deepEqual(
lines('Google Street View needs the photoreal map, which is not available', { stage: 'map' }),
['Google Street View braucht die Google 3D-Karte, die nicht verfügbar ist'],
);
assert.deepEqual(lines('Mapillary could not be switched on', { stage: 'provider' }), [
'Mapillary konnte nicht eingeschaltet werden',
]);
assert.deepEqual(lines('Street Level could not be enabled', { stage: 'layer' }), [
'Straßenebene konnte nicht eingeschaltet werden',
]);
assert.deepEqual(
lines('Latitude must be within ±90° and longitude within ±180°', { stage: 'location' }),
['Der Breitengrad muss innerhalb von ±90° und der Längengrad innerhalb von ±180° liegen'],
);
assert.deepEqual(lines('Mapillary imagery could not be opened', { stage: 'imagery' }), [
'Bilder von Mapillary konnten nicht geöffnet werden',
]);
// The filter clause wraps the reason, already in the interface language,
// and names the filters as their chips do.
const filtered = card('No Mapillary imagery near Paris with the 360° and SINCE filters on', {
stage: 'imagery',
noImagery: true,
filter: { label: '360° and SINCE filters' },
});
assert.deepEqual(filtered.display.lines, [
'Keine Bilder von Mapillary in der Nähe von Paris (aktive Filter: 360°, SEIT)',
]);
assert.match(filtered.say, /with the 360° and SINCE filters on/, 'speech stays English');
} finally {
setLocale('en');
}
});
test('street-level speech names the source and the place, and says which step failed', () => {
const ok = envelope('show_street_level', {
ok: true,