WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

Last modified 8 years ago

#5769 closed enhancement (fixed)

TinyMCE 3.0 Translation update

Reported by: azaozz Owned by: ryan
Milestone: 2.5 Priority: high
Severity: normal Version:
Component: TinyMCE Keywords: has-patch i18n
Focuses: Cc:

Description

The internal translation functions in TinyME 3.0 have changed a bit, complicating the existing translation functionality for WordPress.

This patch adds all strings from TinyMCE's [lang].js and [lang]_dlg.js files in a single wp-langs.php file, so it can be included in the main .pot file and translated by WordPress' standard translation functions (similarly to the other js translations).

The output from this file is added directly into the gzip compressor for TinyMCE, so when TinyMCE initializes, all strings are already translated and loaded.

The only possible drawback is that wp-langs.php will have to be maintained, however the translation strings in TinyMCE don't change much. They may eventually change when a new major version is released and since v 3.0 just came out, it will be at least a year - year and a half before then. (I've also made a small script to check for new/missing strings that can be run after each TinyMCE upgrade in WordPress.)

Attachments (2)

tmce-translation.patch (51.8 KB) - added by azaozz 10 years ago.
wp-langs.php.r6883.patch (929 bytes) - added by rnt 10 years ago.
Correct a string

Download all attachments as: .zip

Change History (11)

#1 follow-up: @nbachiyski
10 years ago

  • Keywords i18n added
  • Priority changed from normal to high

I like the patch. Although I am not a great fan of hard coding the strings, it seems a pretty reasonable compromise.

It would be nice if this one gets sooner in core, so that we can arrange enough testing with the translators.

Just one note: why aren't you escaping the original strings? IMHO you'd better put real new lines in the translatable strings and let js_escape do its work. Thus the strings will look more natural to translators.

#2 @ryan
10 years ago

  • Owner changed from anonymous to ryan

#3 in reply to: ↑ 1 @azaozz
10 years ago

Replying to nbachiyski:

Just one note: why aren't you escaping the original strings? IMHO you'd better put real new lines in the translatable strings and let js_escape do its work. Thus the strings will look more natural to translators.

I've copied them from the different en.js files, so the English version is ready for javascript. Also edited the 2 strings to shorten them and removed the breaks (breaks can be used in the translations as they will run through js_escape() ).

#4 @azaozz
10 years ago

Rechecked all strings again: $str == js_escape($str) is true, no need to run the English version through it, but if you prefer, we will put it back in. Also added couple more comments to better explain the purpose of few strings.

#5 @ryan
10 years ago

(In [6765]) gettext for tinymce strings. Props azaozz. see #5769

#6 @ryan
10 years ago

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

@rnt
10 years ago

Correct a string

#7 follow-up: @rnt
10 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

check the string in trunk/wp-includes/js/tinymce/langs/wp-langs.php:383

#8 in reply to: ↑ 7 @azaozz
10 years ago

Replying to rnt:

check the string in trunk/wp-includes/js/tinymce/langs/wp-langs.php:383

Yes, there's a typo.

#9 @ryan
10 years ago

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

(In [6893]) Fix TinyMCE translation typo. Props rnt. fixes #5769

Note: See TracTickets for help on using tickets.