Like I18N PrimeFaces Editor

I cannot figure out how to add internationalization to the PrimeFaces editor (version 3.2). I need to translate tooltips, texts in comboboxes and change toolbar icons. In the manual for old users http://www.scribd.com/doc/49595285/46/Editor I found an attribute called "language", but it seems to be disabled or removed for the real version.

My project setup is JSF 2 with PrimeFaces 3.2 and GlassFish 3.1.2

I would be very happy if you could show me how I can solve this problem.

Thank you and welcome

Pedro

+3
source share
4 answers

Analysis

PrimeFaces 3.2, , Editor, .

PrimeFaces , . , , , jQuery datePicker, .

editor.js PrimeFaces 3.2, , :

buttons: {
   // name,title,command,popupName (""=use name)
   init:
   .....
   "font,,fontname,|" +
   "size,Font Size,fontsize,|" +
   .....
}

: name,title,command,popupName. title - , .

, , .

maven, .

. .

+2

JMelnik . , !

, editor.js primfaces: 3_3_1/src/main/resources/META-INF/resources/primefaces/editor/editor.js META-INF/resources/primefaces/editor.

. pt_BR:

buttons: {
  // name,title,command,popupName (""=use name)
  init:
  "bold,Negrito,|" +
  "italic,Itálico,|" +
  "underline,Sublinhado,|" +
  "strikethrough,Tachado,|" +
  "subscript,Subscrito,|" +
  "superscript,Sobrescrito,|" +
  "font,Fonte,fontname,|" +
  "size,Tamanho da Fonte,fontsize,|" +
  "style,Estilo,formatblock,|" +
  "color,Cor da fonte,forecolor,|" +
  "highlight,Cor de Destaque do Texto,hilitecolor,color|" +
  "removeformat,Remove Formatting,|" +
  "bullets,Marcadores,insertunorderedlist|" +
  "numbering,Numeração,insertorderedlist|" +
  "outdent,Diminuir Recuo,|" +
  "indent,Aumentar Recuo,|" +
  "alignleft,Alinhar à Esquerda,justifyleft|" +
  "center,Centralizar,justifycenter|" +
  "alignright,Alinhar à Direita,justifyright|" +
  "justify,Justificar,justifyfull|" +
  "undo,,|" +
  "redo,,|" +
  "rule,Insert Horizontal Rule,inserthorizontalrule|" +
  "image,Insert Image,insertimage,url|" +
  "link,Insert Hyperlink,createlink,url|" +
  "unlink,Remove Hyperlink,|" +
  "cut,,|" +
  "copy,,|" +
  "paste,,|" +
  "pastetext,Paste as Text,inserthtml,|" +
  "print,,|" +
  "source,Mostrar Código Fonte"
},

i18n , ( ).

+3

JSF2 Primefaces jQuery, :

$(function(){
    $(".ui-editor-group>.ui-editor-button").each(function(){
        var title = $(this).attr("title").toLowerCase();
        switch(title){
            case "bold":              title = "Negrito"; break;
            case "italic":            title = "Itálico"; break;
            case "underline":         title = "Sublinhado"; break;
            case "align text left":   title = "Alinhado à esquerda"; break;
            case "center":            title = "Centralizado"; break;
            case "align text right":  title = "Alinhado à direita"; break;
            case "justify":           title = "Justificado"; break;
            case "insert hyperlink":  title = "Inserir link"; break;
            case "remove hyperlink":  title = "Remover link"; break;
        }
        $(this).attr("title", title);
    })
})

jQuery . , .

, switch. , switch , - ".toLowerCase()" . , .

JavaScript, .

+2
source

This is a working example that I made for Greek (el_GR locale), all buttons:

$(".ui-editor-group>.ui-editor-button").each(function () {
                                var title = $(this).attr("title").toLowerCase();
                                switch (title) {
                                    case "bold":
                                        title = "Έντονα";
                                        break;
                                    case "italic":
                                        title = "Πλάγια";
                                        break;
                                    case "underline":
                                        title = "Υπογραμμισμένα";
                                        break;
                                    case "align text left":
                                        title = "Στοίχιση αριστερά";
                                        break;
                                    case "center":
                                        title = "Στοίχιση στο κέντρο";
                                        break;
                                    case "align text right":
                                        title = "Στοίχiση δεξιά";
                                        break;
                                    case "justify":
                                        title = "Στοίχιση";
                                        break;
                                    case "insert hyperlink":
                                        title = "Εισαγωγή συνδέσμου";
                                        break;
                                    case "remove hyperlink":
                                        title = "Αφαίρεση συνδέσμου";
                                        break;
                                    case "strikethrough":
                                        title = "Διεγραμμένα";
                                        break;
                                    case "subscript":
                                        title = "Δείκτης";
                                        break;
                                    case "superscript":
                                        title = "Εκθέτης";
                                        break;
                                    case "font":
                                        title = "Γραμματοσειρά";
                                        break;
                                    case "font size":
                                        title = "Μέγεθος γραμματοσειράς";
                                        break;
                                    case "style":
                                        title = "Στυλ";
                                        break;
                                    case "font color":
                                        title = "Χρώμα γραμματοσειράς";
                                        break;
                                    case "text highlight color":
                                        title = "Χρώμα επισήμανσης κειμένου";
                                        break;
                                    case "remove formatting":
                                        title = "Κατάργηση μορφοποίησης";
                                        break;
                                    case "bullets":
                                        title = "Λίστα με κουκκίδες";
                                        break;
                                    case "numbering":
                                        title = "Αριθμητική λίστα";
                                        break;
                                    case "outdent":
                                        title = "Προεξοχή";
                                        break;
                                    case "indent":
                                        title = "Εσοχή";
                                        break;
                                    case "undo":
                                        title = "Αναίρέση";
                                    case "redo":
                                        title = "Επαναφορά";
                                        break;
                                    case "insert horizontal rule":
                                        title = "Eισαγωγή οριζόντιας γραμμής";
                                        break;
                                    case "insert image":
                                        title = "Εισαγωγή εικόνας";
                                        break;
                                    case "cut":
                                        title = "Κόψιμο";
                                        break;
                                    case "copy":
                                        title = "Αντιγραφή";
                                        break;
                                    case "paste":
                                        title = "Επικόλληση";
                                        break;
                                    case "paste as text":
                                        title = "Επικόλληση ως απλό κείμενο";
                                        break;
                                    case "print":
                                        title = "Εκτύπωση";
                                        break;
                                    case "show source":
                                        title = "Εμφάνιση κώδικα";
                                        break;
                                    case "Show Rich Text":
                                        title = "Εμφάνιση εύκολης επεξεργασίας άρθρου";
                                        break;
                                }
                                $(this).attr("title", title);
                            });
+1
source

All Articles