Ticket #9637 (closed Bug: fixed)

Opened 5 years ago

Last modified 5 years ago

TinyMCE: (remove style) hard coded in javascript -> Can't be i18nized

Reported by: toutpt Owned by:
Priority: minor Milestone: 4.0
Component: Internationalization Version:
Keywords: TuneUp31 Cc:

Description

 https://svn.plone.org/svn/collective/Products.TinyMCE/trunk/Products/TinyMCE/skins/tinymce/tiny_mce_init.js

line 186: hSelection?.push('{ title: "(remove style)", tag: "", className: "", type: "Selection" }');

I can't i18nized this and I don't have any ideas how to.

Change History

comment:2 Changed 5 years ago by vincentfretin

  • Cc vincentfretin added
  • Keywords sprinti18n20091013 added

comment:3 Changed 5 years ago by esteele

  • Milestone changed from 3.x to 4.0

comment:4 Changed 5 years ago by vincentfretin

  • Keywords sprinti18n20091013 removed
  • Cc toutpt@…, vincentfretin removed

comment:5 Changed 5 years ago by vincentfretin

  • Keywords TuneUp added

comment:6 Changed 5 years ago by dmunicio

One way would be to create tinymce-i18n.js.pt file. This would be a js file generated with page code with something like this:

label_remove_style='<tal:message i18n:translate="label_tinymce_remove_style">(remove style)</tal:message>';

and replace in tiny_mce_init.js the line with the following:

hSelection?.push('{ title: label_remove_style, tag: "", className: "", type: "Selection" }');

Another way is to generate a tinymce.xml.py (python script which generates a xml) and read it with HTTPRequest from JavaScript code.

comment:7 Changed 5 years ago by dmunicio

Another possibility is create a js with the translations and detect language from python.

Take a look to the code in:

collective.js.jquery/collective/js/jquery/jquery-ui-i18n.js collective.js.jquery/collective/viewlet.py

comment:8 Changed 5 years ago by jessilfp

  • Keywords TuneUp30 added; TuneUp removed

comment:9 Changed 5 years ago by vincentfretin

dmunicio, please feel free to fix the issue, you are on the right path. :)

A related issue is #10339 where we have "No items in this folder" hard coded in plonelink.js and ploneimage.js

comment:10 Changed 5 years ago by dmunicio

I don't have commit rights, but I will try to make the patch. Should I request SVN commit rights or attach the patch here?

comment:11 Changed 5 years ago by esteele

Yes, please do request commit rights for the collective. Patches are wonderful, but nothing beats people fixing things themselves. :)

comment:12 Changed 5 years ago by vincentfretin

  • Keywords TuneUp31 added; TuneUp30 removed

comment:13 Changed 5 years ago by dmunicio

I have some fixes and I have also requested commit access to Products.TinyMCE: https://dev.plone.org/plone.org/ticket/1916

comment:14 Changed 5 years ago by dmunicio

  • Status changed from new to closed
  • Resolution set to fixed

Hardcoded messages are now translatable in plone.tinymce i18n domain

I have committed the changes: https://dev.plone.org/collective/changeset/117335/Products.TinyMCE/trunk/

Note that I have rebuilt plone.tinymce.pot but I have updated only es/LC_MESSAGES/plone.tinymce.po because I don't know if I should update the other '.po' files.

Note: See TracTickets for help on using tickets.