mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 02:44:02 +00:00
Merge upstream/main: Street View rework meets i18n
Upstream's Street View rework (second imagery provider, one source at a time, OPEN STREET VIEW button, key-alternative guidance) rewrote exactly the street-level regions this branch localizes. Resolved as upstream logic + re-applied localization: - keySetupCore: new unlock copy kept as msg() data; added keySetupAlternativeKeyNames() returning machine values (registry key names) so key-setup core stays English while presentation localizes. - New src/ui/keyGuidance.js: localized key-guidance composer shared by layerPanel and streetLevelPresentation (requirement sentence plus the "or light X to use your Y key" alternatives tail, placeholders only). - streetLevelPresentation: keyGuidance()/presentNearest()/presentMeta relocalized (t/tn + formatNumber instead of toLocaleString); renderModes and month-precision dates kept from upstream. - layer-panels.html: upstream row ids, sl-meta-row and the new button kept, data-i18n hooks re-applied (incl. OPEN STREET VIEW fallback). - es/ru catalogs: 13 new keys, stale unlock key replaced in place. npm run i18n: complete for es and ru. npm test: 6345/6347; the one failure (devFreshDotenv provenance) also fails on plain upstream/main and on the pre-merge tip here - this machine leaks OPENAI_API_KEY into spawned children with a replaced env, so it is environmental.
This commit is contained in:
commit
eb802408e4
59 files changed
+4009
-199
No files matched your search
@@ -0,0 +1,45 @@
|
||||
import {
|
||||
keySetupAlternativeKeyNames,
|
||||
keySetupRequirementEnvVars,
|
||||
} from '../keySetupCore.mjs';
|
||||
import { t } from '../i18n/index.js';
|
||||
|
||||
// Localized key-guidance sentences. keySetupCore owns the machine values
|
||||
// (env-var names, registry titles) because it also runs in node-side
|
||||
// key-setup builds that stay English; this presentation boundary owns the
|
||||
// sentences, composed with placeholders so word order can differ per language.
|
||||
|
||||
/** The Provider Settings hint for a missing key, or '' for a hidden key. */
|
||||
export function keyRequirementText(requiresKeyId) {
|
||||
const envVars = keySetupRequirementEnvVars(requiresKeyId);
|
||||
return envVars
|
||||
? t('Needs {envVars} — add it in Provider Settings', { envVars })
|
||||
: '';
|
||||
}
|
||||
|
||||
/**
|
||||
* A requirement sentence, plus the switched-off sources that would draw with
|
||||
* a key already set.
|
||||
* @param {string} requirement What `keyRequirementText` said ('' allowed).
|
||||
* @param {Array<{label: string, requiresKeyId?: string|null}>} [alternatives]
|
||||
*/
|
||||
export function withKeyAlternatives(requirement, alternatives = []) {
|
||||
if (!alternatives.length) return requirement;
|
||||
const named = keySetupAlternativeKeyNames(alternatives);
|
||||
const option = ({ label, name }) =>
|
||||
name
|
||||
? t('light {label} to use your {name} key', { label, name })
|
||||
: t('light {label}', { label });
|
||||
if (requirement)
|
||||
return t('{requirement}, or {offer}', {
|
||||
requirement,
|
||||
offer: named.map(option).join(t(', or ')),
|
||||
});
|
||||
// No requirement: the offer stands alone, so it opens with a capital.
|
||||
const { label, name } = named[0];
|
||||
const lead = name
|
||||
? t('Light {label} to use your {name} key', { label, name })
|
||||
: t('Light {label}', { label });
|
||||
const tail = named.slice(1).map(option).join(t(', or '));
|
||||
return tail ? t('{lead}, or {tail}', { lead, tail }) : lead;
|
||||
}
|
||||
Reference in new issue
Block a user