MCPcopy
hub / github.com/ResearAI/AutoFigure-Edit / t

Function t

web/app.js:587–603  ·  view source on GitHub ↗
(key, vars = {})

Source from the content-addressed store, hash-verified

585 }
586
587 function t(key, vars = {}) {
588 const parts = key.split(".");
589 let value = I18N[currentLocale];
590 for (const part of parts) {
591 value = value?.[part];
592 }
593 if (value == null) {
594 value = I18N.en;
595 for (const part of parts) {
596 value = value?.[part];
597 }
598 }
599 if (typeof value !== "string") {
600 return key;
601 }
602 return value.replace(/\{(\w+)\}/g, (_, name) => `${vars[name] ?? ""}`);
603 }
604
605 function setLocale(locale) {
606 if (locale !== "zh" && locale !== "en") {

Callers 12

getProviderLabelFunction · 0.85
getImageProviderLabelFunction · 0.85
updateRouteSummaryFunction · 0.85
syncRoutingControlsFunction · 0.85
applyInputLocaleFunction · 0.85
initInputPageFunction · 0.85
applyImportLocaleFunction · 0.85
initImportPageFunction · 0.85
applyGuideLocaleFunction · 0.85
uploadReferenceFunction · 0.85
initCanvasPageFunction · 0.85
setCanvasLocaleFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected