fix(i18n): Street Level errors in the UI language; hint row wraps

The Street Level error line and its toasts showed provider errors as
thrown (Google's key-rejected message stayed English). They go through
translateKnown now. In a translation the coverage hint no longer shrinks
to a narrow column beside OPEN GOOGLE STREET VIEW: the button takes its
own line when both do not fit. English layout is unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
German KhokhlovandClaude Opus 5.5 committed 2026-10-13 20:47:00 +04:00
1 parent 8b0bb031b6
commit 9f1e409193
3 files changed
+21 -5

No files matched your search

+5 -4
View File
@@ -5,7 +5,7 @@ import {
SINCE_STOPS, SINCE_STOPS,
} from './streetLevelPresentation.js'; } from './streetLevelPresentation.js';
import { t } from '../i18n/index.js'; import { t, translateKnown } from '../i18n/index.js';
const RENDER_MODE_KEY = 'gev:street-level:render-mode'; const RENDER_MODE_KEY = 'gev:street-level:render-mode';
const FOCUSABLE = const FOCUSABLE =
'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])'; 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
@@ -229,7 +229,8 @@ export class StreetLevelControls {
await this.actions.setEnabled?.(true); await this.actions.setEnabled?.(true);
} catch (error) { } catch (error) {
this.actions.showToast?.( this.actions.showToast?.(
error?.message || t('Street Level could not start'), translateKnown(error?.message || '') ||
t('Street Level could not start'),
); );
return false; return false;
} }
@@ -242,7 +243,7 @@ export class StreetLevelControls {
await this.actions.setEnabled?.(!enabled); await this.actions.setEnabled?.(!enabled);
} catch (error) { } catch (error) {
this.actions.showToast?.( this.actions.showToast?.(
error?.message || t('Street Level toggle failed'), translateKnown(error?.message || '') || t('Street Level toggle failed'),
); );
} }
} }
@@ -276,7 +277,7 @@ export class StreetLevelControls {
await this.actions.setEnabled?.(false); await this.actions.setEnabled?.(false);
} catch (error) { } catch (error) {
this.actions.showToast?.( this.actions.showToast?.(
error?.message || t('Street Level toggle failed'), translateKnown(error?.message || '') || t('Street Level toggle failed'),
); );
} }
} }
+2 -1
View File
@@ -253,7 +253,8 @@ export function presentStreetLevelPanel(state, { now = Date.now() } = {}) {
providers: presentProviders(state), providers: presentProviders(state),
error: keyMissing error: keyMissing
? null ? null
: state.street.error || state.coverage.error || null, : translateKnown(state.street.error || state.coverage.error || '') ||
null,
filter: { pano: filter.pano, sinceDays: Number(filter.sinceDays) || 0 }, filter: { pano: filter.pano, sinceDays: Number(filter.sinceDays) || 0 },
filterControls: { filterControls: {
pano: state.filterControls?.pano !== false, pano: state.filterControls?.pano !== false,
+14
View File
@@ -205,6 +205,20 @@ button.sl-status:focus-visible {
display: none; display: none;
} }
/* Longer translations: rather than squeeze the hint into a narrow column
beside the button, put the button on its own line when both do not fit. */
html:not([lang='en']) .sl-meta-row {
flex-wrap: wrap;
}
html:not([lang='en']) .sl-meta-row .sl-meta {
flex: 1 1 14em;
}
html:not([lang='en']) .sl-meta-row .sl-nearest-btn {
flex: 1 0 auto;
}
/* ── Errors ──────────────────────────────────────────────────────────────── */ /* ── Errors ──────────────────────────────────────────────────────────────── */
.sl-error { .sl-error {
font-family: var(--font-sans); font-family: var(--font-sans);