Translations for the new TinyMCE "toggle toolbar" button

Bug #1319243 reported by Aaron Wells on 2014-05-14
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Mahara
Medium
Robert Lyon

Bug Description

In https://reviews.mahara.org/#/c/3289/ (part of bug 1282341), we're adding a button that toggles the TinyMCE toolbar. By default it shows just the most basic buttons. When you click this button, it toggles up and displays everything.

The problem is that this plugin only contains translations for English, Spanish, German, and French. And, it stores its language strings in Javascript files, so they can't be fixed as part of a standard Mahara langpack. There is only one language string in this plugin. It's a tooltip that says "Toggle toolbars" when you mouseover the button. So, just the one string, but on the other hand it's a very prominent string, because we use TinyMCE so widely.

What's the best solution for this?

Aaron Wells (u-aaronw) wrote :

Some ideas:

1. Change the tooltoggle lang files into PHP scripts that can use standard Mahara language strings. The problem is that this would require patching TinyMCE's language code, because it's hardcoded to look for files following a certain naming pattern ending in "*.js". Although, maybe it could be as simple as changing that code so that it looks for *.js or *.php?

2. Eliminate the lang string. Change the icon so that it is more obvious what it does even without a tooltip, and then eliminate the tooltip. This may cause accessibility issues, though, because then a screenreader can't tell what this button does? Although I can't recall whether screenreaders can actually use TinyMCE in the first place.

3. Pass in this lang string via some other method. Does TinyMCE's localization API let us pass in lang strings via some other method, which could be accessed by some Javascript printed directly to the page by the smarty() method in web.php?

Aaron Wells (u-aaronw) wrote :

4. Patch the Mahara Launchpad -> po file -> langpack toolchain, so that it builds this particular string into a js file instead of a php file. I think given our current limited facility at manipulating that toolchain, though, this might well be the hardest method.

5. Manage this one language string outside of the langpack infrastructure. File gerrit patches in order to update this language string. The challenge here, is that because this string is not in a Mahara lang file, translators will not be prompted to translate it in the Launchpad translation interface. Perhaps we could add it to a langpack just as a placeholder, in order to trigger that prompt? This would be a really slipshod way of doing things, though.

Robert Lyon (robertl-9) wrote :

Ah I didn't read this before updating the patch in https://reviews.mahara.org/#/c/3289/

I went for the option number 3 to fix this problem - as it was the easiest one and looking at the list Aaron made I believe it should be done a more robust fashion - rather than having to tweak lib/mahara.php to get the string to show - in the future.

I'd suggest renaming this bug to be something more generic so it can stay open and a better solution can be created. Because it will not be just for tinymce plugins that we will need js script translations I imagine.

The patch that Robert mentions has been merged. If we need something more robust in the future, we'll create a new bug.

Changed in mahara:
status: Confirmed → Fix Committed
assignee: nobody → Robert Lyon (robertl-9)
Aaron Wells (u-aaronw) on 2014-10-21
Changed in mahara:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers