MCPcopy
hub / github.com/vercel/hyper / lang

Method lang

bin/yarn-standalone.js:35391–35404  ·  view source on GitHub ↗
(key, ...args)

Source from the content-addressed store, hash-verified

35389 }
35390
35391 lang(key, ...args) {
35392 const msg = (_index || _load_index())[this.language][key] || (_index || _load_index()).en[key];
35393 if (!msg) {
35394 throw new ReferenceError(`No message defined for language key ${key}`);
35395 }
35396
35397 // stringify args
35398 const stringifiedArgs = stringifyLangArgs(args);
35399
35400 // replace $0 placeholders with args
35401 return msg.replace(/\$(\d+)/g, (str, i) => {
35402 return stringifiedArgs[i];
35403 });
35404 }
35405
35406 /**
35407 * `stringifyLangArgs` run `JSON.stringify` on strings too causing

Callers 15

yarn-standalone.jsFile · 0.45
fromDirectoryMethod · 0.45
bailoutMethod · 0.45
initMethod · 0.45
flattenMethod · 0.45
_checkUpdateMethod · 0.45
requestMethod · 0.45
getOneTimePasswordFunction · 0.45
explodeHostedGitFragmentFunction · 0.45
getRefOverHTTPMethod · 0.45

Calls 2

_load_indexFunction · 0.85
stringifyLangArgsFunction · 0.85

Tested by

no test coverage detected