constructor()

in src/package.ts [1059:1087]


	constructor(manifest: Manifest) {
		super(manifest);

		if (
			!manifest.contributes ||
			!manifest.contributes.localizations ||
			manifest.contributes.localizations.length === 0
		) {
			return;
		}

		const localizations = manifest.contributes.localizations;
		const translations: { [languageId: string]: string } = Object.create(null);

		// take last reference in the manifest for any given language
		for (const localization of localizations) {
			for (const translation of localization.translations) {
				if (translation.id === 'vscode' && !!translation.path) {
					const translationPath = util.normalize(translation.path.replace(/^\.[\/\\]/, ''));
					translations[localization.languageId.toUpperCase()] = `extension/${translationPath}`;
				}
			}
		}

		// invert the map for later easier retrieval
		for (const languageId of Object.keys(translations)) {
			this.translations[translations[languageId]] = languageId;
		}
	}