View
 

How to translate nicEdit

Page history last edited by sara 14 years, 6 months ago
  1. Download developer version
  2. Open nicEdit.js file
  3. Go to this few lines an edit the help text, for example, the translation into Spanish would be:
 
Aroud line 252:
var nicEditorConfig = bkClass.extend({

    buttons : {

        'bold' : {name : __('Negrita'), command : 'Bold', tags : ['B','STRONG'], css : {'font-weight' : 'bold'}, key : 'b'},

        'italic' : {name : __('Cursiva'), command : 'Italic', tags : ['EM','I'], css : {'font-style' : 'italic'}, key : 'i'},

        'underline' : {name : __('Subrayado'), command : 'Underline', tags : ['U'], css : {'text-decoration' : 'underline'}, key : 'u'},

        'left' : {name : __('Alinear texto a la izquierda'), command : 'justifyleft', noActive : true},

        'center' : {name : __('Centrar texto'), command : 'justifycenter', noActive : true},

        'right' : {name : __('Alinear texto a la derecha'), command : 'justifyright', noActive : true},

        'justify' : {name : __('Justificar texto'), command : 'justifyfull', noActive : true},

        'ol' : {name : __('Insertar lista ordenada'), command : 'insertorderedlist', tags : ['OL']},

        'ul' :     {name : __('Insertar lista desordenada'), command : 'insertunorderedlist', tags : ['UL']},

        'subscript' : {name : __('SubIndice'), command : 'subscript', tags : ['SUB']},

        'superscript' : {name : __('SuperIndice'), command : 'superscript', tags : ['SUP']},

        'strikethrough' : {name : __('Tachar'), command : 'strikeThrough', css : {'text-decoration' : 'line-through'}},

        'removeformat' : {name : __('Borrar formato'), command : 'removeformat', noActive : true},

        'indent' : {name : __('Identar'), command : 'indent', noActive : true},

        'outdent' : {name : __('Eliminar identado'), command : 'outdent', noActive : true},

        'hr' : {name : __('Barra separadora'), command : 'insertHorizontalRule', noActive : true}

 
Aroud line 1046:
var nicLinkOptions = {

    buttons : {

        'link' : {name : 'Enlazar', type : 'nicLinkButton', tags : ['A']},

        'unlink' : {name : 'Eliminar enlace',  command : 'unlink', noActive : true}

    }

 
Aroud line 1120:
var nicCodeOptions = {

    buttons : {

        'xhtml' : {name : 'Visualizar HTML', type : 'nicCodeButton'}

    }

};

 
Aroud line 1131:
    addPane : function() {

        this.addForm({

            '' : {type : 'title', txt : 'Editar HTML'},

            'code' : {type : 'content', 'value' : this.ne.selectedInstance.getContent(), style : {width: '340px', height : '200px'}}

        });

    },

Please correct my English, thanks!

high power led

potty training girls

short wedding dresses

Comments (4)

Rui Patinha said

at 12:02 pm on Jun 5, 2009

Hi,

How about keeping the original source code intact, and just configure the buttons when creating the editor? This way, we can keep the original code safe for future upgrades...

var rtEditor = new nicEditor({
maxHeight:250,
iconsPath : '../nicEditorIcons2.gif',
buttons: {
'negrito' : {name : __('Negrito'), command : 'Bold', tags : ['B','STRONG'], css : {'font-weight' : 'bold'}, key : 'b'},
'italico' : {name : __('Itálico'), command : 'Italic', tags : ['EM','I'], css : {'font-style' : 'italic'}, key : 'i'},
'sublinhado' : {name : __('Sublinhado'), command : 'Underline', tags : ['U'], css : {'text-decoration' : 'underline'}, key : 'u'},
'lstOrd' : {name : __('Inserir/Eliminar Numeração'), command : 'insertorderedlist', tags : ['OL']},
'marcas' : {name : __('Inserir/Eliminar Marcas'), command : 'insertunorderedlist', tags : ['UL']},
},
buttonList:['negrito','italico','sublinhado','marcas','lstOrd','link','unlink','smile'],
iconList : {"negrito":1,"center":2,"hr":3,"indent":4,"italico":5,"justify":6,"left":7,"lstOrd":8,"outdent":9,"removeformat":10,"right":11,"save":22,"strikethrough":13,"subscript":14,"superscript":15,"marcas":16,"sublinhado":17,"image":18,"link":19,"unlink":20,"close":21,"arrow":23,"upload":24,"smile":25}
}).panelInstance('commenttext');

Rui Patinha said

at 12:02 pm on Jun 5, 2009

The rest of if can be sent as external plugin, like this:

<script type="text/javascript" src="external_plugins.js"></script>

and in external_plugins.js:

/* START CONFIG */
var nicLinkOptions = {
buttons : {
'link' : {name : 'Inserir/Editar Hiperliga&ccedil;&atilde;o', type : 'nicLinkButton', tags : ['A']},
'unlink' : {name : 'Eliminar Hiperliga&ccedil;&atilde;o', command : 'unlink', noActive : true}
}
};
/* END CONFIG */

var nicLinkButton = nicEditorAdvancedButton.extend({
addPane : function() {
this.ln = this.ne.selectedInstance.selElm().parentTag('A');
this.addForm({
'' : {type : 'title', txt : 'Inserir/Editar Hiperliga&ccedil;&atilde;o'},
'href' : {type : 'text', txt : 'URL', value : 'http://', style : {width: '150px'}},
'title' : {type : 'text', txt : 'T&iacute;tulo'},
'target' : {type : 'select', txt : 'Abrir', options : {'' : 'Mesma Janela', '_blank' : 'Nova Janela'},style : {width : '100px'}}
},this.ln);
},

submit : function(e) {
var url = this.inputs['href'].value;
if(url == "http://" || url == "") {
alert("Por favor introduza a hiperliga&ccedil;&atilde;o URL");
return false;
}
this.removePane();

if(!this.ln) {
var tmp = 'javascript:nicTemp();';
this.ne.nicCommand("createlink",tmp);
this.ln = this.findElm('A','href',tmp);
}
if(this.ln) {
this.ln.setAttributes({
href : this.inputs['href'].value,
title : this.inputs['title'].value,
target : this.inputs['target'].options[this.inputs['target'].selectedIndex].value
});
}
}
});

nicEditors.registerPlugin(nicPlugin,nicLinkOptions);

Marco said

at 9:43 pm on Aug 15, 2009

This is my solution:

Modified the function __ in nicEdit.js

function __(s) {
return (l10n[s] === undefined) ? s : l10n[s];
}

Created a new file called l10n.js (example in portuguese):

var l10n = {
'Click to Bold': 'Negrito', 'Click to Italic': 'Itálico',
'Click to Underline': 'Sublinhado', 'Left Align': 'Alinhar à esquerda',
'Center Align': 'Centrar', 'Right Align': 'Alinhar à direita',
'Justify Align': 'Justificar', 'Insert Ordered List': 'Inserir Lista ordenada',
'Insert Unordered List': 'Inserir Lista não-ordenada', 'Click to Subscript': 'Inferior à linha',
'Click to Superscript': 'Superior à linha', 'Click to Strike Through': 'Riscado',
'Remove Formatting': 'Remover formatação', 'Indent Text': 'Aumentar avanço',
'Remove Indent': 'Diminuir avanço', 'Horizontal Rule': 'Separador Horizontal',
'Add Link': 'Adicionar Link', 'Remove Link': 'Remover Link',
'Title': 'Titulo', 'Add/Edit Link': 'Inserir/Editar Link',
'Current Window': 'Mesma Janela', 'New Window': 'Nova Janela',
'Open In': 'Abre Em'
};

Inserted l10n.js in the html page before the nicEdit.js

Not all the strings in the nicEdit.js file are returned by the function __, you have to modify them

Example:
'unlink' : {name : 'Remove Link', command : 'unlink', noActive : true} has to be 'unlink' : {name : __('Remove Link'), command : 'unlink', noActive : true}

sara said

at 12:49 pm on Jun 7, 2010

You don't have permission to comment on this page.