MCPcopy
hub / github.com/Kong/insomnia / lang

Method lang

packages/insomnia/bin/yarn-standalone.js:34957–34970  ·  view source on GitHub ↗
(key, ...args)

Source from the content-addressed store, hash-verified

34955 }
34956
34957 lang(key, ...args) {
34958 const msg = (_index || _load_index())[this.language][key] || (_index || _load_index()).en[key];
34959 if (!msg) {
34960 throw new ReferenceError(`No message defined for language key ${key}`);
34961 }
34962
34963 // stringify args
34964 const stringifiedArgs = stringifyLangArgs(args);
34965
34966 // replace $0 placeholders with args
34967 return msg.replace(/\$(\d+)/g, (str, i) => {
34968 return stringifiedArgs[i];
34969 });
34970 }
34971
34972 /**
34973 * `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