function loadNlsBundle()

in src/node/main.ts [330:359]


function loadNlsBundle(header: MetadataHeader, bundlePath: string): NlsBundle | undefined {
	let result: NlsBundle;

	// Core decided to use a language pack. Do the same in the extension
	if (supportsLanguagePack()) {
		try {
			result = loadNlsBundleOrCreateFromI18n(header, bundlePath);
		} catch (err) {
			console.log(`Load or create bundle failed `, err);
		}
	}
	if (!result) {
		// No language pack found, but core is running in language pack mode
		// Don't try to use old in the box bundles since the might be stale
		// Fall right back to the default bundle.
		if (options.languagePackSupport) {
			return loadDefaultNlsBundle(bundlePath);
		}
		let candidate = findInTheBoxBundle(bundlePath);
		if (candidate) {
			try {
				return readJsonFileSync(candidate);
			} catch (err) {
				console.log(`Loading in the box message bundle failed.`, err);
			}
		}
		result = loadDefaultNlsBundle(bundlePath);
	}
	return result;
}