diff options
author | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-03-22 10:53:30 +0100 |
---|---|---|
committer | Étienne Loks <etienne.loks@iggdrasil.net> | 2017-03-22 10:53:30 +0100 |
commit | 9f5f3f33f78c95113522700d8473a65660c98e3a (patch) | |
tree | e4ef26d532c6144b05638fcbb017e74a86ca7aab /chimere | |
parent | 0527e33e8733d5fe92a2f732f9529269cc5aba9a (diff) | |
download | Chimère-9f5f3f33f78c95113522700d8473a65660c98e3a.tar.bz2 Chimère-9f5f3f33f78c95113522700d8473a65660c98e3a.zip |
TinyMCE: add format button, add french localization
Diffstat (limited to 'chimere')
-rw-r--r-- | chimere/static/chimere/js/textareas.js | 36 | ||||
-rw-r--r-- | chimere/static/tinymce/langs/fr_FR.js | 219 | ||||
-rw-r--r-- | chimere/widgets.py | 23 |
3 files changed, 252 insertions, 26 deletions
diff --git a/chimere/static/chimere/js/textareas.js b/chimere/static/chimere/js/textareas.js index e40252d..cb2485b 100644 --- a/chimere/static/chimere/js/textareas.js +++ b/chimere/static/chimere/js/textareas.js @@ -1,5 +1,5 @@ /* base function shared by some pages */ -/* Copyright (C) 2009 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> +/* Copyright (C) 2009-2017 Étienne Loks <etienne.loks_AT_peacefrogsDOTnet> This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -16,18 +16,22 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. See the file COPYING for details. */ -if (!window.tinymce_init){ - window.tinymce_init = true; - tinyMCE.init({ - mode : "textareas", - theme: 'modern', - editor_selector : "mceEditor", - relative_urls : false, - toolbar_items_size: 'small', - plugins: 'link', - menubar: '', - toolbar1: 'bold italic underline | bullist numlist | link | removeformat', - toolbar2: "", - toolbar3: "" - }); -}; +$(function() { + if (!window.tinymce_init){ + window.tinymce_init = true; + options = { + mode : "textareas", + theme: 'modern', + editor_selector : "mceEditor", + relative_urls : false, + toolbar_items_size: 'small', + plugins: 'link', + menubar: '', + toolbar1: 'bold italic underline | bullist numlist | link | removeformat styleselect', + toolbar2: "", + toolbar3: "" + }; + if (window.tinymce_lang) options['language'] = window.tinymce_lang; + tinyMCE.init(options); + }; +}); diff --git a/chimere/static/tinymce/langs/fr_FR.js b/chimere/static/tinymce/langs/fr_FR.js new file mode 100644 index 0000000..b74abd4 --- /dev/null +++ b/chimere/static/tinymce/langs/fr_FR.js @@ -0,0 +1,219 @@ +tinymce.addI18n('fr_FR',{ +"Cut": "Couper", +"Heading 5": "En-t\u00eate 5", +"Header 2": "Titre 2", +"Your browser doesn't support direct access to the clipboard. Please use the Ctrl+X\/C\/V keyboard shortcuts instead.": "Votre navigateur ne supporte pas la copie directe. Merci d'utiliser les touches Ctrl+X\/C\/V.", +"Heading 4": "En-t\u00eate 4", +"Div": "Div", +"Heading 2": "En-t\u00eate 2", +"Paste": "Coller", +"Close": "Fermer", +"Font Family": "Police", +"Pre": "Pre", +"Align right": "Aligner \u00e0 droite", +"New document": "Nouveau document", +"Blockquote": "Citation", +"Numbered list": "Num\u00e9rotation", +"Heading 1": "En-t\u00eate 1", +"Headings": "En-t\u00eates", +"Increase indent": "Augmenter le retrait", +"Formats": "Formats", +"Headers": "Titres", +"Select all": "Tout s\u00e9lectionner", +"Header 3": "Titre 3", +"Blocks": "Blocs", +"Undo": "Annuler", +"Strikethrough": "Barr\u00e9", +"Bullet list": "Puces", +"Header 1": "Titre 1", +"Superscript": "Exposant", +"Clear formatting": "Effacer la mise en forme", +"Font Sizes": "Taille de police", +"Subscript": "Indice", +"Header 6": "Titre 6", +"Redo": "R\u00e9tablir", +"Paragraph": "Paragraphe", +"Ok": "Ok", +"Bold": "Gras", +"Code": "Code", +"Italic": "Italique", +"Align center": "Centrer", +"Header 5": "Titre 5", +"Heading 6": "En-t\u00eate 6", +"Heading 3": "En-t\u00eate 3", +"Decrease indent": "Diminuer le retrait", +"Header 4": "Titre 4", +"Paste is now in plain text mode. Contents will now be pasted as plain text until you toggle this option off.": "Le presse-papiers est maintenant en mode \"texte plein\". Les contenus seront coll\u00e9s sans retenir les formatages jusqu'\u00e0 ce que vous d\u00e9sactiviez cette option.", +"Underline": "Soulign\u00e9", +"Cancel": "Annuler", +"Justify": "Justifier", +"Inline": "En ligne", +"Copy": "Copier", +"Align left": "Aligner \u00e0 gauche", +"Visual aids": "Aides visuelle", +"Lower Greek": "Grec minuscule", +"Square": "Carr\u00e9", +"Default": "Par d\u00e9faut", +"Lower Alpha": "Alpha minuscule", +"Circle": "Cercle", +"Disc": "Disque", +"Upper Alpha": "Alpha majuscule", +"Upper Roman": "Romain majuscule", +"Lower Roman": "Romain minuscule", +"Name": "Nom", +"Anchor": "Ancre", +"You have unsaved changes are you sure you want to navigate away?": "Vous avez des modifications non enregistr\u00e9es, \u00eates-vous s\u00fbr de quitter la page?", +"Restore last draft": "Restaurer le dernier brouillon", +"Special character": "Caract\u00e8res sp\u00e9ciaux", +"Source code": "Code source", +"B": "B", +"R": "R", +"G": "V", +"Color": "Couleur", +"Right to left": "Droite \u00e0 gauche", +"Left to right": "Gauche \u00e0 droite", +"Emoticons": "Emotic\u00f4nes", +"Robots": "Robots", +"Document properties": "Propri\u00e9t\u00e9 du document", +"Title": "Titre", +"Keywords": "Mots-cl\u00e9s", +"Encoding": "Encodage", +"Description": "Description", +"Author": "Auteur", +"Fullscreen": "Plein \u00e9cran", +"Horizontal line": "Ligne horizontale", +"Horizontal space": "Espacement horizontal", +"Insert\/edit image": "Ins\u00e9rer\/modifier une image", +"General": "G\u00e9n\u00e9ral", +"Advanced": "Avanc\u00e9", +"Source": "Source", +"Border": "Bordure", +"Constrain proportions": "Conserver les proportions", +"Vertical space": "Espacement vertical", +"Image description": "Description de l'image", +"Style": "Style", +"Dimensions": "Dimensions", +"Insert image": "Ins\u00e9rer une image", +"Zoom in": "Zoomer", +"Contrast": "Contraste", +"Back": "Retour", +"Gamma": "Gamma", +"Flip horizontally": "Retournement horizontal", +"Resize": "Redimensionner", +"Sharpen": "Affiner", +"Zoom out": "D\u00e9zoomer", +"Image options": "Options de l'image", +"Apply": "Appliquer", +"Brightness": "Luminosit\u00e9", +"Rotate clockwise": "Rotation horaire", +"Rotate counterclockwise": "Rotation anti-horaire", +"Edit image": "Modifier l'image", +"Color levels": "Niveaux de couleur", +"Crop": "Rogner", +"Orientation": "Orientation", +"Flip vertically": "Retournement vertical", +"Invert": "Inverser", +"Insert date\/time": "Ins\u00e9rer date\/heure", +"Remove link": "Enlever le lien", +"Url": "Url", +"Text to display": "Texte \u00e0 afficher", +"Anchors": "Ancres", +"Insert link": "Ins\u00e9rer un lien", +"New window": "Nouvelle fen\u00eatre", +"None": "n\/a", +"The URL you entered seems to be an external link. Do you want to add the required http:\/\/ prefix?": "L'URL que vous avez entr\u00e9e semble \u00eatre un lien externe. Voulez-vous ajouter le pr\u00e9fixe http:\/\/ n\u00e9cessaire?", +"Target": "Cible", +"The URL you entered seems to be an email address. Do you want to add the required mailto: prefix?": "L'URL que vous avez entr\u00e9e semble \u00eatre une adresse e-mail. Voulez-vous ajouter le pr\u00e9fixe mailto: n\u00e9cessaire?", +"Insert\/edit link": "Ins\u00e9rer\/modifier un lien", +"Insert\/edit video": "Ins\u00e9rer\/modifier une vid\u00e9o", +"Poster": "Publier", +"Alternative source": "Source alternative", +"Paste your embed code below:": "Collez votre code d'int\u00e9gration ci-dessous :", +"Insert video": "Ins\u00e9rer une vid\u00e9o", +"Embed": "Int\u00e9grer", +"Nonbreaking space": "Espace ins\u00e9cable", +"Page break": "Saut de page", +"Paste as text": "Coller comme texte", +"Preview": "Pr\u00e9visualiser", +"Print": "Imprimer", +"Save": "Enregistrer", +"Could not find the specified string.": "Impossible de trouver la cha\u00eene sp\u00e9cifi\u00e9e.", +"Replace": "Remplacer", +"Next": "Suiv", +"Whole words": "Mots entiers", +"Find and replace": "Trouver et remplacer", +"Replace with": "Remplacer par", +"Find": "Chercher", +"Replace all": "Tout remplacer", +"Match case": "Respecter la casse", +"Prev": "Pr\u00e9c ", +"Spellcheck": "V\u00e9rification orthographique", +"Finish": "Finie", +"Ignore all": "Tout ignorer", +"Ignore": "Ignorer", +"Add to Dictionary": "Ajouter au dictionnaire", +"Insert row before": "Ins\u00e9rer une ligne avant", +"Rows": "Lignes", +"Height": "Hauteur", +"Paste row after": "Coller la ligne apr\u00e8s", +"Alignment": "Alignement", +"Border color": "Couleur de la bordure", +"Column group": "Groupe de colonnes", +"Row": "Ligne", +"Insert column before": "Ins\u00e9rer une colonne avant", +"Split cell": "Diviser la cellule", +"Cell padding": "Espacement interne cellule", +"Cell spacing": "Espacement inter-cellulles", +"Row type": "Type de ligne", +"Insert table": "Ins\u00e9rer un tableau", +"Body": "Corps", +"Caption": "Titre", +"Footer": "Pied", +"Delete row": "Effacer la ligne", +"Paste row before": "Coller la ligne avant", +"Scope": "Etendue", +"Delete table": "Supprimer le tableau", +"H Align": "Alignement H", +"Top": "Haut", +"Header cell": "Cellule d'en-t\u00eate", +"Column": "Colonne", +"Row group": "Groupe de lignes", +"Cell": "Cellule", +"Middle": "Milieu", +"Cell type": "Type de cellule", +"Copy row": "Copier la ligne", +"Row properties": "Propri\u00e9t\u00e9s de la ligne", +"Table properties": "Propri\u00e9t\u00e9s du tableau", +"Bottom": "Bas", +"V Align": "Alignement V", +"Header": "En-t\u00eate", +"Right": "Droite", +"Insert column after": "Ins\u00e9rer une colonne apr\u00e8s", +"Cols": "Colonnes", +"Insert row after": "Ins\u00e9rer une ligne apr\u00e8s", +"Width": "Largeur", +"Cell properties": "Propri\u00e9t\u00e9s de la cellule", +"Left": "Gauche", +"Cut row": "Couper la ligne", +"Delete column": "Effacer la colonne", +"Center": "Centr\u00e9", +"Merge cells": "Fusionner les cellules", +"Insert template": "Ajouter un th\u00e8me", +"Templates": "Th\u00e8mes", +"Background color": "Couleur d'arri\u00e8re-plan", +"Custom...": "Personnalis\u00e9...", +"Custom color": "Couleur personnalis\u00e9e", +"No color": "Aucune couleur", +"Text color": "Couleur du texte", +"Show blocks": "Afficher les blocs", +"Show invisible characters": "Afficher les caract\u00e8res invisibles", +"Words: {0}": "Mots : {0}", +"Insert": "Ins\u00e9rer", +"File": "Fichier", +"Edit": "Editer", +"Rich Text Area. Press ALT-F9 for menu. Press ALT-F10 for toolbar. Press ALT-0 for help": "Zone Texte Riche. Appuyer sur ALT-F9 pour le menu. Appuyer sur ALT-F10 pour la barre d'outils. Appuyer sur ALT-0 pour de l'aide.", +"Tools": "Outils", +"View": "Voir", +"Table": "Tableau", +"Format": "Format" +});
\ No newline at end of file diff --git a/chimere/widgets.py b/chimere/widgets.py index 6c56ecc..95a9526 100644 --- a/chimere/widgets.py +++ b/chimere/widgets.py @@ -216,6 +216,8 @@ if settings.ENABLE_TINYMCE: ADMIN_TINY_JS = TINYMCE_JS[:] + \ ["%schimere/js/textareas_admin.js" % settings.STATIC_URL] +TINYMCE_LANGUAGES = ['fr_FR'] + class TextareaWidgetBase(forms.Textarea): """ @@ -243,6 +245,17 @@ class TextareaWidgetBase(forms.Textarea): } </style> """ % args[0] + current_language = "" + if settings.LANGUAGE_CODE.replace('-', '_') in TINYMCE_LANGUAGES: + current_language = settings.LANGUAGE_CODE.replace('-', '_') + elif settings.LANGUAGE_CODE.split('-')[0] in TINYMCE_LANGUAGES: + current_language = settings.LANGUAGE_CODE.split('-')[0] + if current_language: + rendered += """ + <script type='text/javascript'> + window.tinymce_lang = "{}"; + </script> + """.format(current_language) return mark_safe(rendered) @@ -266,16 +279,6 @@ class FullTextareaWidget(TextareaWidgetBase): kwargs['attrs']['class'] += ' ' kwargs['attrs']['class'] += 'mceEditor' rendered = super(FullTextareaWidget, self).render(*args, **kwargs) - rendered += """ -<style> -.mce-tinymce{ - position: initial; -} -.field-%s label{ - padding: 0.9em 1em; -} -</style> -""" % args[0] return mark_safe(rendered) |