javascript 如何翻译 Summernote 编辑器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/33261094/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to translate Summernote editor
提问by zdarsky.peter
I found that Summernote plugin, has a lot of js files with translations. But how to apply them? I already included them to my page.
我发现 Summernote 插件,有很多带有翻译的 js 文件。但是如何应用它们呢?我已经将它们包含在我的页面中。
采纳答案by zdarsky.peter
回答by Pablo Corezzola
Example:
例子:
File #1 (js) Save as "summernote-ES.js" :
文件 #1 (js) 另存为“summernote-ES.js”:
(function ($) {
$.extend($.summernote.lang, {
'es-ES': {
font: {
bold: 'Negrita',
bla, bla, bla (this file has 150 lines) file complete
bla, bla, bla(此文件有 150 行) 文件已完成
File #2 (html) index.html:
文件 #2 (html) index.html:
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.css">
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/theme/monokai.css">
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/codemirror.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/3.20.0/mode/xml/xml.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/codemirror/2.36.0/formatting.js"></script>
<!-- include summernote css/js-->
<link href="summernote.css">
<script src="summernote.js"></script>
<script src="[your-url]/summernote-ES.js"></script>
<script>
$(document).ready(function(){
$('.summernote').summernote({ lang: 'es-ES' });
})
</script>