本文整理匯總了TypeScript中vs/workbench/parts/experiments/electron-browser/experimentalPrompt.ExperimentalPrompts.getLocalizedText方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript ExperimentalPrompts.getLocalizedText方法的具體用法?TypeScript ExperimentalPrompts.getLocalizedText怎麽用?TypeScript ExperimentalPrompts.getLocalizedText使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類vs/workbench/parts/experiments/electron-browser/experimentalPrompt.ExperimentalPrompts
的用法示例。
在下文中一共展示了ExperimentalPrompts.getLocalizedText方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test('Test getPromptText', () => {
const simpleTextCase: IExperimentActionPromptProperties = {
promptText: 'My simple prompt',
commands: []
};
const multipleLocaleCase: IExperimentActionPromptProperties = {
promptText: {
en: 'My simple prompt for en',
de: 'My simple prompt for de',
'en-au': 'My simple prompt for Austrailian English',
'en-us': 'My simple prompt for US English'
},
commands: []
};
const englishUSTextCase: IExperimentActionPromptProperties = {
promptText: {
'en-us': 'My simple prompt for en'
},
commands: []
};
const noEnglishTextCase: IExperimentActionPromptProperties = {
promptText: {
'de-de': 'My simple prompt for German'
},
commands: []
};
assert.equal(ExperimentalPrompts.getLocalizedText(simpleTextCase.promptText, 'any-language'), simpleTextCase.promptText);
assert.equal(ExperimentalPrompts.getLocalizedText(multipleLocaleCase.promptText, 'en'), multipleLocaleCase.promptText['en']);
assert.equal(ExperimentalPrompts.getLocalizedText(multipleLocaleCase.promptText, 'de'), multipleLocaleCase.promptText['de']);
assert.equal(ExperimentalPrompts.getLocalizedText(multipleLocaleCase.promptText, 'en-au'), multipleLocaleCase.promptText['en-au']);
assert.equal(ExperimentalPrompts.getLocalizedText(multipleLocaleCase.promptText, 'en-gb'), multipleLocaleCase.promptText['en']);
assert.equal(ExperimentalPrompts.getLocalizedText(multipleLocaleCase.promptText, 'fr'), multipleLocaleCase.promptText['en']);
assert.equal(ExperimentalPrompts.getLocalizedText(englishUSTextCase.promptText, 'fr'), englishUSTextCase.promptText['en-us']);
assert.equal(!!ExperimentalPrompts.getLocalizedText(noEnglishTextCase.promptText, 'fr'), false);
});