本文整理汇总了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;
};