mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
Merge upstream/main: KartaView provider meets i18n
Upstream's KartaView PR (#1121) extracted the Mapillary coverage engine into a shared lineCoverage.js and made the panel wording provider-specific (coverage noun/action, SINCE upload-date note, highlightsSequence legend gate), again in the regions this branch localizes. - mapillary/coverage.js: taken as upstream's thin re-export of the new lineCoverage.js; the generic too-high hint stays msg()-marked, now in lineCoverage.js where the default lives. - kartaview/policy.js: coverage hints (tooHigh, noCoverage) marked as msg() data so they translate like every other coverage hint; thrown error messages stay English, matching the Mapillary precedent. - presentMeta: KartaView counts streets, and Russian plurals need the noun inside the template, so the count line gets its own literal tn pair keyed off coverageLabel.noun, falling back to the sequences pair; upstream's noun/action data contract is untouched. - uiState legend: upstream highlightsSequence gate with t('Selected'); sinceNote localized with a {names} placeholder. - layer-panels.html: sl-since-note wiring kept, data-i18n hooks kept. - CHANGELOG: both sides kept. es/ru: 4 new keys each. npm run i18n complete (953 messages each); npm test 6504/6506 (the one failure is the pre-existing environmental OPENAI_API_KEY leak in devFreshDotenv, unrelated); build passes.
This commit is contained in:
commit
40fb2031bb
63 files changed
+10862
-1264
No files matched your search
@@ -18,6 +18,9 @@ import { msg, t } from '../../i18n/index.js';
|
||||
* @property {string} color The source's one colour.
|
||||
* @property {boolean} [groundClick]
|
||||
* @property {Array<'pano'|'since'>} [filters]
|
||||
* @property {{noun: string, action: string}|null} [coverageLabel]
|
||||
* @property {boolean} [highlightsSequence] Its lines turn cyan when their sequence is selected.
|
||||
* @property {'capture'|'upload'} [sinceBasis] What its SINCE compares.
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -35,6 +38,8 @@ export function summarizeCoverage(providers) {
|
||||
? msg('No street-level imagery providers configured')
|
||||
: [...new Set(active.map((p) => p.hint).filter(Boolean))].join(' · '),
|
||||
error: active.find((p) => p.error)?.error || null,
|
||||
// One source is lit at a time; its wording counts the lines.
|
||||
label: active.find((p) => p.coverageLabel)?.coverageLabel || null,
|
||||
keyRequired:
|
||||
active.length > 0 && active.every((p) => p.keyRequired === true),
|
||||
keyRejected:
|
||||
@@ -69,6 +74,20 @@ export function filterControls(providers) {
|
||||
return { pano: honoured('pano'), since: honoured('since') };
|
||||
}
|
||||
|
||||
/**
|
||||
* The note under SINCE when a lit provider dates its imagery by upload,
|
||||
* e.g. "KartaView: by upload date", or null.
|
||||
* @param {Array<ProviderSnapshot>} providers
|
||||
*/
|
||||
export function sinceNote(providers) {
|
||||
const names = providers
|
||||
.filter((p) => p.on && p.sinceBasis === 'upload')
|
||||
.map((p) => p.name);
|
||||
return names.length
|
||||
? t('{names}: by upload date', { names: names.join(', ') })
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The panel snapshot from core state and provider snapshots. The legend has
|
||||
* one swatch per active source that draws coverage lines, then Selected.
|
||||
@@ -93,7 +112,13 @@ export function composeUIState({
|
||||
label: provider.name,
|
||||
color: provider.color,
|
||||
}));
|
||||
if (legend.length)
|
||||
// "Selected" only beside a source whose lines turn cyan when selected.
|
||||
if (
|
||||
active.some(
|
||||
(provider) =>
|
||||
provider.groundClick !== true && provider.highlightsSequence !== false,
|
||||
)
|
||||
)
|
||||
legend.push({ key: 'selected', label: t('Selected'), color: COLORS.selected });
|
||||
return {
|
||||
enabled,
|
||||
@@ -103,6 +128,7 @@ export function composeUIState({
|
||||
keyRejected,
|
||||
filter: { ...filter },
|
||||
filterControls: filterControls(providers),
|
||||
sinceNote: sinceNote(providers),
|
||||
providers: providers.map((p) => ({ ...p })),
|
||||
coverage,
|
||||
legend,
|
||||
|
||||
Reference in new issue
Block a user