INNER CODE UNIT · TypeScript
getMessagesFromTranslationsService
baizunxian/zerorunner · frontend/src/components/monaco/nls/index.ts:209
function getMessagesFromTranslationsService(translationServiceUrl, language, name) {
return __awaiter(this, void 0, void 0, function* () {
const url = endWithSlash(translationServiceUrl) + endWithSlash(language) + 'vscode/' + endWithSlash(name);
const res = yield fetch(url);
if (res.ok) {
const messages = yield res.json();
return messages;
}
throw new Error(\`\${res.status} - \${res.statusText}\`);
});
}
function createScopedLocalize(scope) {
return function (idx, defaultValue) {
const restArgs = Array.prototype.slice.call(arguments, 2);
return _format(scope[idx], restArgs);
};
}
// export function localize(data, message, ...args) {