nls processor: be aware of relative path to extensions
This commit is contained in:
parent
a6ed1ac5e6
commit
638e4357f0
2 changed files with 21 additions and 7 deletions
|
@ -549,7 +549,8 @@ export class NLSProcessor extends BaseProcessor {
|
||||||
for (const localization of localizations) {
|
for (const localization of localizations) {
|
||||||
for (const translation of localization.translations) {
|
for (const translation of localization.translations) {
|
||||||
if (translation.id === 'vscode' && !!translation.path) {
|
if (translation.id === 'vscode' && !!translation.path) {
|
||||||
translations[localization.languageId.toUpperCase()] = `extension/${util.normalize(translation.path)}`;
|
const translationPath = util.normalize(translation.path.replace(/^\.[\/\\]/, ''));
|
||||||
|
translations[localization.languageId.toUpperCase()] = `extension/${translationPath}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -942,22 +942,35 @@ describe('toVsixManifest', () => {
|
||||||
version: '0.0.1',
|
version: '0.0.1',
|
||||||
engines: Object.create(null),
|
engines: Object.create(null),
|
||||||
contributes: {
|
contributes: {
|
||||||
localizations: [{
|
localizations: [
|
||||||
languageId: 'de',
|
{
|
||||||
translations: [{ id: 'vscode', path: 'fake.json' }, { id: 'vscode.go', path: 'what.json' }]
|
languageId: 'de',
|
||||||
}]
|
translations: [
|
||||||
|
{ id: 'vscode', path: 'de.json' },
|
||||||
|
{ id: 'vscode.go', path: 'what.json' }
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
languageId: 'pt',
|
||||||
|
translations: [
|
||||||
|
{ id: 'vscode', path: './translations/pt.json' }
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const files = [
|
const files = [
|
||||||
{ path: 'extension/fake.json', contents: new Buffer('') }
|
{ path: 'extension/de.json', contents: new Buffer('') },
|
||||||
|
{ path: 'extension/translations/pt.json', contents: new Buffer('') }
|
||||||
];
|
];
|
||||||
|
|
||||||
return _toVsixManifest(manifest, files)
|
return _toVsixManifest(manifest, files)
|
||||||
.then(parseXmlManifest)
|
.then(parseXmlManifest)
|
||||||
.then(result => {
|
.then(result => {
|
||||||
const assets = result.PackageManifest.Assets[0].Asset;
|
const assets = result.PackageManifest.Assets[0].Asset;
|
||||||
assert(assets.some(asset => asset.$.Type === 'Microsoft.VisualStudio.Code.Translation.DE' && asset.$.Path === 'extension/fake.json'));
|
assert(assets.some(asset => asset.$.Type === 'Microsoft.VisualStudio.Code.Translation.DE' && asset.$.Path === 'extension/de.json'));
|
||||||
|
assert(assets.some(asset => asset.$.Type === 'Microsoft.VisualStudio.Code.Translation.PT' && asset.$.Path === 'extension/translations/pt.json'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue