Merge pull request #286 from Microsoft/localizedLangs
Add property for supported languages
This commit is contained in:
commit
778fa339e1
3 changed files with 16 additions and 1 deletions
|
@ -12,6 +12,7 @@
|
||||||
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="<%- engine %>" />
|
<Property Id="Microsoft.VisualStudio.Code.Engine" Value="<%- engine %>" />
|
||||||
<Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value="<%- extensionDependencies %>" />
|
<Property Id="Microsoft.VisualStudio.Code.ExtensionDependencies" Value="<%- extensionDependencies %>" />
|
||||||
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="<%- extensionPack %>" />
|
<Property Id="Microsoft.VisualStudio.Code.ExtensionPack" Value="<%- extensionPack %>" />
|
||||||
|
<Property Id="Microsoft.VisualStudio.Code.LocalizedLanguages" Value="<%- localizedLanguages %>" />
|
||||||
<% if (links.repository) { %>
|
<% if (links.repository) { %>
|
||||||
<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="<%- links.repository %>" />
|
<Property Id="Microsoft.VisualStudio.Services.Links.Source" Value="<%- links.repository %>" />
|
||||||
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="<%- links.repository %>" />
|
<Property Id="Microsoft.VisualStudio.Services.Links.Getstarted" Value="<%- links.repository %>" />
|
||||||
|
|
|
@ -208,7 +208,9 @@ class ManifestProcessor extends BaseProcessor {
|
||||||
enableMarketplaceQnA,
|
enableMarketplaceQnA,
|
||||||
customerQnALink,
|
customerQnALink,
|
||||||
extensionDependencies: _(manifest.extensionDependencies || []).uniq().join(','),
|
extensionDependencies: _(manifest.extensionDependencies || []).uniq().join(','),
|
||||||
extensionPack: _(manifest.extensionPack || []).uniq().join(',')
|
extensionPack: _(manifest.extensionPack || []).uniq().join(','),
|
||||||
|
localizedLanguages: (manifest.contributes && manifest.contributes.localizations) ?
|
||||||
|
manifest.contributes.localizations.map(loc => loc.languageNameLocalized || loc.languageName || loc.languageId).join(',') : ''
|
||||||
};
|
};
|
||||||
|
|
||||||
if (isGitHub) {
|
if (isGitHub) {
|
||||||
|
|
|
@ -999,6 +999,7 @@ describe('toVsixManifest', () => {
|
||||||
localizations: [
|
localizations: [
|
||||||
{
|
{
|
||||||
languageId: 'de',
|
languageId: 'de',
|
||||||
|
languageName: 'German',
|
||||||
translations: [
|
translations: [
|
||||||
{ id: 'vscode', path: 'de.json' },
|
{ id: 'vscode', path: 'de.json' },
|
||||||
{ id: 'vscode.go', path: 'what.json' }
|
{ id: 'vscode.go', path: 'what.json' }
|
||||||
|
@ -1006,6 +1007,8 @@ describe('toVsixManifest', () => {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
languageId: 'pt',
|
languageId: 'pt',
|
||||||
|
languageName: 'Portuguese',
|
||||||
|
languageNameLocalized: 'Português',
|
||||||
translations: [
|
translations: [
|
||||||
{ id: 'vscode', path: './translations/pt.json' }
|
{ id: 'vscode', path: './translations/pt.json' }
|
||||||
]
|
]
|
||||||
|
@ -1025,6 +1028,15 @@ describe('toVsixManifest', () => {
|
||||||
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/de.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'));
|
assert(assets.some(asset => asset.$.Type === 'Microsoft.VisualStudio.Code.Translation.PT' && asset.$.Path === 'extension/translations/pt.json'));
|
||||||
|
|
||||||
|
const properties = result.PackageManifest.Metadata[0].Properties[0].Property;
|
||||||
|
const localizedLangProp = properties.filter(p => p.$.Id === 'Microsoft.VisualStudio.Code.LocalizedLanguages');
|
||||||
|
assert.equal(localizedLangProp.length, 1);
|
||||||
|
|
||||||
|
const localizedLangs = localizedLangProp[0].$.Value.split(',');
|
||||||
|
assert.equal(localizedLangs.length, 2);
|
||||||
|
assert.equal(localizedLangs[0], 'German');
|
||||||
|
assert.equal(localizedLangs[1], 'Português');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue