MCPcopy
hub / github.com/ys1231/MoveCertificate / t

Function t

webdev/src/i18n.ts:375–390  ·  view source on GitHub ↗
(key: string, ...args: string[])

Source from the content-addressed store, hash-verified

373 * t('deletedReboot', 'abc.0') → 'abc.0 已删除,重启生效!'
374 */
375export function t(key: string, ...args: string[]): string {
376 const dict = translations[key as I18nKey];
377 if (!dict) {
378 console.warn(`i18n: 缺少翻译 key "${key}"`);
379 return key;
380 }
381
382 let text: string = dict[currentLang] || dict['en'] || key;
383
384 // 替换占位符 {0} {1} ...
385 args.forEach((arg, i) => {
386 text = text.replace(`{${i}}`, arg);
387 });
388
389 return text;
390}
391
392/**
393 * 刷新当前语言(在 setLang 后调用,重新读取)

Callers 14

showFunction · 0.85
getVersionInfoFunction · 0.85
getLoggerInfoFunction · 0.85
getInstallCertResultsFunction · 0.85
applyI18nFunction · 0.85
updateButtonTextsFunction · 0.85
loadCertsTabFunction · 0.85
switchModeHandlerFunction · 0.85
loadModeTabFunction · 0.85
loadLogTabFunction · 0.85
refreshLogTabFunction · 0.85
main.tsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected