我无法让翻译工作。
[https://imperavi.com/redactor/ Version 3,Yii 2.0.12,PHP 7.1.16]
这是我在yii2(php框架)中的代码:
use yii\easyii\widgets\Redactor;
use yii\widgets\ActiveForm;
...
<?= $form->field($model, "content")->widget(Redactor::className(),[
'options' => [
'id'=>"redactor",
'minHeight' => 200,
'imageUpload' => Url::to(['/admin/redactor/upload'], true),
'buttons' => ['html', 'formatting', 'bold', 'italic', 'deleted', 'unorderedlist', 'orderedlist', 'outdent', 'indent', 'alignment', 'horizontalrule', 'link', 'image', 'file','clips'],
'plugins' => ['fontcolor', 'fontfamily', 'fontsize', 'table','clips','filemanager','imagemanager','alignment','fullscreen','video','widget'],
'maxHeight' => 500,
'placeholder' => 'Skriv inn, eller lim inn kopiert tekst og/eller bilder her..',
'toolbarFixed',
'lang' => 'no',
'clickToEdit' => true,
'clickToCancel'=> ['title'=> 'Avbryt'],
],
])->label(false) ?>
这是它产生的:
jQuery('#notes-content').redactor({
"imageUpload":"http://byggmannkalk.no/admin/redactor/upload",
"fileUpload":"/admin/redactor/upload","id":"redactor",
"minHeight":200,
"buttons":["html","formatting","bold","italic","deleted","unorderedlist","orderedlist","outdent","indent","alignment","horizontalrule","link","image","file","clips"],
"plugins":["fontcolor","fontfamily","fontsize","table","clips","filemanager","imagemanager","alignment","fullscreen","video","widget"],
"maxHeight":500,
"placeholder":"Skriv inn, eller lim inn kopiert tekst og/eller bilder her..",
"0":"toolbarFixed",
"lang":"nb",
"clickToEdit":true,
"clickToCancel":{"title":"Cancel"},
"imageUploadErrorCallback":function(json){alert(json.error);},
"fileUploadErrorCallback":function(json){alert(json.error);}
});
语言文件给我一个控制台错误:
VM2426:2 Uncaught TypeError: Cannot read property 'opts' of undefined
at eval (eval at globalEval (jquery.js?v=1523865201:343), <anonymous>:2:13)
at eval (eval at globalEval (jquery.js?v=1523865201:343), <anonymous>:74:3)
at eval (<anonymous>)
at Function.globalEval (jquery.js?v=1523865201:343)
at text script (jquery.js?v=1523865201:9208)
at ajaxConvert (jquery.js?v=1523865201:8243)
at done (jquery.js?v=1523865201:8707)
at XMLHttpRequest.<anonymous> (jquery.js?v=1523865201:9123)
at XMLHttpRequest.send (catcher.js:197)
at Object.send (jquery.js?v=1523865201:9175)
指向我的语言文件:
(function ($) {
$.Redactor.opts.langs['nb'] = {
html: 'HTML',
....
filename: 'Filnavn (valgfritt)',
edit: 'Endre',
center: 'Midten'
};
})(jQuery);
是否可以修改我的redactor实例的创建,以便将其添加到$而不仅仅是for $('#notes-content')?
我缺少一个参数吗?
语言文件将在整个程序中使用Redactor的许多地方使用,所以我不想修改它们。
谢谢你的帮助。
聚苯乙烯。我在演示网站(https://imperavi.com/redactor/examples/language/translations/)注意到他们修改了语言文件:
(function($R)
{
$R.lang['fi'] = {
...
"redo": "Redo"
};
})(Redactor);