-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makes vs/nls.availableLanguages work for AMD again.
- Loading branch information
Showing
5 changed files
with
97 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* This fix ensures that old nls-plugin configurations are still respected by the new localization solution. */ | ||
/* We should try to avoid this file and find a different solution. */ | ||
/* Warning: This file still has to work when replacing "\n" with " "! */ | ||
|
||
/** | ||
* @type {typeof define} | ||
*/ | ||
const globalDefine = globalThis.define; | ||
globalDefine('vs/nls.messages-loader', [], function (...args) { | ||
return { | ||
load: (name, req, load, config) => { | ||
const requestedLanguage = config['vs/nls']?.availableLanguages?.['*']; | ||
if (!requestedLanguage || requestedLanguage === 'en') { | ||
load({}); | ||
} else { | ||
req([`vs/nls.messages.${requestedLanguage}`], () => { | ||
load({}); | ||
}); | ||
} | ||
} | ||
}; | ||
}); | ||
globalDefine( | ||
'vs/nls.messages', | ||
['require', 'exports', 'vs/nls.messages-loader!'], | ||
function (require, exports) { | ||
Object.assign(exports, { | ||
getNLSMessages: () => globalThis._VSCODE_NLS_MESSAGES, | ||
getNLSLanguage: () => globalThis._VSCODE_NLS_LANGUAGE | ||
}); | ||
} | ||
); | ||
define = function (...args) { | ||
if (args.length > 0 && args[0] === 'vs/nls.messages') { | ||
return; | ||
} | ||
return globalDefine(...args); | ||
}; | ||
define.amd = true; |