1

ckeditor 用のカスタム プラグインを作成しました。現在、選択した言語でツールチップの言語を動的に変更しようとしています。翻訳されたツールチップ テキストを ckeditor の lang フォルダーにある対応する js ファイルに入れようとしましたが、うまくいきません。

4

1 に答える 1

3

ツールバー ボタンを作成する場合は、次のように、プラグインのpluginDefinition.init内にeditor.ui.addButtonを使用して追加します。

CKEDITOR.plugins.add( 'pluginName', {
    lang: 'lan,gua,ges,sup,por,ted,by,this,plu,gin,com,ma,se,pa,ra,ted',
    icons: 'icons,used,by,this,plugin',
    requires: 'anotherPlugin',
    init: function( editor ) {
        // Register the toolbar button.
        if ( editor.ui.addButton ) {
            editor.ui.addButton( 'ButtonName', {
                label: editor.lang.pluginName.labelName, // Your label
                command: 'yourcommand', // Command name
                directional: true, // Depends on BiDi support, optional
                toolbar: 'list,10' // Wherever you want, in fact
            });             
        }
        ...
     }
 });

あなたの言語がfooであるとすると、次pluginName/lang/foo.jsのようになります。

CKEDITOR.plugins.setLang( 'pluginName', 'foo', {
    labelName: 'My label!'
});

のオブジェクト リテラル内のプロパティに追加fooすることを忘れないでください。langpluginDefinition

CKEDITOR.plugins.add( 'pluginName', {
    lang: 'foo',
    ...
 });

一般的に言えば、あなたがそれを使いたいものは何でも、editor.lang.pluginName.labelNameの中で利用できます。init

于 2013-07-22T08:03:43.657 に答える