本文整理匯總了TypeScript中tinymce/core/api/util/I18n.setCode函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript setCode函數的具體用法?TypeScript setCode怎麽用?TypeScript setCode使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了setCode函數的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: function
suite.test('Switch language', function () {
I18n.add('code1', {
text: 'translation1'
});
RawAssertions.assertEq('Should not have switched language code', 'en', I18n.getCode());
RawAssertions.assertEq('Should not be in in rtl mode', false, I18n.isRtl());
RawAssertions.assertEq('Should not get code1 translation', 'text', I18n.translate('text'));
I18n.add('code2', {
_dir: 'rtl',
text: 'translation2'
});
I18n.setCode('code2');
RawAssertions.assertEq('Should have switched language code', 'code2', I18n.getCode());
RawAssertions.assertEq('Should be in in rtl mode', true, I18n.isRtl());
RawAssertions.assertEq('Should be get code2 translation', 'translation2', I18n.translate('text'));
I18n.setCode('en');
});
示例2: Theme
UnitTest.asynctest('browser.tinymce.core.EditorRtlTest', (success, failure) => {
Theme();
const sAssertRtl = (label: string, rtl: boolean) => Step.sync(() => {
RawAssertions.assertEq(label, rtl, I18n.isRtl());
});
const sSetLangCode = (code: string) => Step.sync(() => {
I18n.setCode(code);
});
EditorManager.addI18n('ar', {
Bold: 'Bold test',
_dir: 'rtl'
});
I18n.setCode('en');
TinyLoader.setup(function (editor, onSuccess, onFailure) {
Pipeline.async({}, [
sAssertRtl('Should be in rtl mode after creating an editor in arabic', true),
sSetLangCode('en'),
sAssertRtl('Should not be in rtl mode when switching back to english', false),
sSetLangCode('ar'),
sAssertRtl('Should be in rtl mode after switching back to arabic', true),
sSetLangCode('en')
], function () {
onSuccess();
}, onFailure);
}, {
language: 'ar',
selector: 'textarea',
add_unload_trigger: false,
disable_nodechange: true,
entities: 'raw',
indent: false,
base_url: '/project/tinymce/js/tinymce'
}, success, failure);
});
示例3: function
const teardown = function () {
I18n.rtl = false;
I18n.setCode('en');
Factory.get('Control').rtl = false;
};
示例4:
const sSetLangCode = (code: string) => Step.sync(() => {
I18n.setCode(code);
});
示例5: function
const getLanguagePackUrl = function (code, languages?) {
languagePackUrl = null;
I18n.setCode(code);
PluginManager.requireLangPack('plugin', languages);
return languagePackUrl;
};