mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-05 10:53:59 +00:00
Merge origin/main: Google Street View provider, translated
Main added the Google Street View street-level provider and key guidance that offers another source. Its new text goes through t()/msg() with ru and es entries; the key guidance the panel shows is built in the UI language by src/ui/keyGuidance.js, while keySetupCore.mjs keeps the English sentences the server and AI tools use. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
commit
8b0bb031b6
63 files changed
+4097
-210
No files matched your search
@@ -0,0 +1,49 @@
|
||||
/**
|
||||
* Key guidance in the UI language. keySetupCore.mjs builds the same sentences
|
||||
* in English for the server and the AI tools; these are the ones people read.
|
||||
*/
|
||||
import {
|
||||
KEY_SETUP_KEYS,
|
||||
keySetupRequirementEnvVars,
|
||||
} from '../keySetupCore.mjs';
|
||||
import { t, translateKnown } from '../i18n/index.js';
|
||||
|
||||
/** "Needs X — add it in Provider Settings", or '' for an unknown or hidden key. */
|
||||
export function keyRequirementText(id) {
|
||||
const envVars = id ? keySetupRequirementEnvVars(id) : null;
|
||||
return envVars
|
||||
? t('Needs {envVars} — add it in Provider Settings', { envVars })
|
||||
: '';
|
||||
}
|
||||
|
||||
/** The key's product name in title case: GOOGLE MAPS → Google Maps. */
|
||||
function keyName(id) {
|
||||
const entry = KEY_SETUP_KEYS.find((candidate) => candidate.id === id);
|
||||
return entry
|
||||
? entry.title
|
||||
.toLowerCase()
|
||||
.replace(/\b\w/g, (letter) => letter.toUpperCase())
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* The requirement, then the switched-off sources that would draw with a key
|
||||
* already set (see keySetupWithAlternatives).
|
||||
*
|
||||
* @param {string} requirement
|
||||
* @param {Array<{label: string, requiresKeyId: string|null}>} [alternatives]
|
||||
*/
|
||||
export function keyGuidanceText(requirement, alternatives = []) {
|
||||
const options = alternatives.map(({ label, requiresKeyId }) => {
|
||||
const name = keyName(requiresKeyId);
|
||||
const source = translateKnown(label);
|
||||
return name
|
||||
? t('light {source} to use your {name} key', { source, name })
|
||||
: t('light {source}', { source });
|
||||
});
|
||||
if (!options.length) return requirement;
|
||||
const offer = options.join(t(', or '));
|
||||
if (requirement)
|
||||
return t('{requirement}, or {offer}', { requirement, offer });
|
||||
return offer.charAt(0).toLocaleUpperCase() + offer.slice(1);
|
||||
}
|
||||
Reference in new issue
Block a user