MCPcopy
hub / github.com/KOWX712/Tricky-Addon-Update-Target-List / getString

Function getString

webui/scripts/language.js:29–43  ·  view source on GitHub ↗
(id, ...args)

Source from the content-addressed store, hash-verified

27 * @returns {string} - The formatted translation
28 */
29export function getString(id, ...args) {
30 let translation = translations[id] || (baseTranslations && baseTranslations[id]) || id;
31 if (args.length === 0) return translation;
32
33 let argIndex = 0;
34 return translation.replace(/%(?:(\d+)\$)?([%sdfx])/g, (match, index, type) => {
35 if (type === '%') return '%';
36 if (index) {
37 const i = parseInt(index) - 1;
38 return args[i] !== undefined ? args[i] : match;
39 } else {
40 return args[argIndex++] !== undefined ? args[argIndex - 1] : match;
41 }
42 });
43}
44
45/**
46 * Parse XML translation file into a JavaScript object

Callers 15

initOverlayFunction · 0.90
onMessageFunction · 0.90
fetchAndSetKeyboxFunction · 0.90
fetchCustomKeyboxFunction · 0.90
saveCustomKeyboxEntryFunction · 0.90
removeCustomKeyboxEntryFunction · 0.90
exportCustomKeyboxConfigFunction · 0.90
importCustomKeyboxConfigFunction · 0.90
initCustomKeyboxFunction · 0.90
about.jsFile · 0.90
downloadUpdateFunction · 0.90
installUpdateFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected