#10278 closed defect (bug) (fixed)
thickbox.js strings are not i18n
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 2.9 | Priority: | normal |
Severity: | normal | Version: | 2.8 |
Component: | I18N | Keywords: | has-patch tested |
Focuses: | Cc: |
Description
Plugins are starting to rely on WP's own set of included JS libs, and therefore are dropping their translation for these libs' strings.
For instance, NextGEN Gallery is now using WP's ThickBox lib rather than including its own version, and WP's contains the following non-i18n strings - which, therefore, appear in English in all cases:
line 87:
TB_NextHTML = "<span id='TB_next'> <a href='#'>Next ></a></span>";
line 90:
TB_PrevHTML = "<span id='TB_prev'> <a href='#'>< Prev</a></span>";
line 95:
TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);
line 129 (title is 'Close'):
jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'><img src='" + tb_closeImage + "' /></a></div>");
Note that:
- there might be others in this file, I only did a quick survey following this report on the WPFR forums ;
- other included libraries might also have non-i18n strings, which should be tracked down.
Attachments (1)
Change History (11)
#2
@
16 years ago
- Keywords has-patch added; needs-patch removed
- Owner changed from nbachiyski to azaozz
- Status changed from new to reviewing
#3
follow-up:
↓ 4
@
16 years ago
Nice patch. One small error though:
"swfuploadL10n" shall probably be "thickboxL10n"
in the line
'l10n_print_after' => 'try{convertEntities(swfuploadL10n);}catch(e){};'
of the patched wp-includes/script-loader.php
#4
in reply to:
↑ 3
@
16 years ago
Replying to TobiasBg:
Nice patch. One small error though:
"swfuploadL10n" shall probably be "thickboxL10n"
Bad, copy/paste, bad.
Fixed.
#5
@
16 years ago
Maybe the localization can also be used to fix #6453 (see my first suggestion there).
#7
@
15 years ago
- Keywords tested added
Tested in the wild against new translation and looks good so far.
#8
@
15 years ago
- Cc rodrigovolponi added
- Keywords 2nd-opinion added
This patch seems to not work, at least using WP 3.0.1 as the bug have described (NextGEN plugin using Wordpress' lib thickbox.js).
The output of the template is always like this, always not translated):
<script type='text/javascript'> /* <![CDATA[ */ var thickboxL10n = { next: "Next >", prev: "< Prev", image: "Image", of: "of", close: "Close", noiframes: "This feature requires inline frames. You have iframes disabled or your browser does not support them." }; try{convertEntities(thickboxL10n);}catch(e){}; /* ]]> */ </script>
It is true for every script loaded by script-loader.php. For instance, at the "wp-admin/post-new.php", all the scripts called by script-loader.php are not translated. There is one exception: autosaveL10n.
I have two installations on different servers using the current Wordpress version (3.0.1) and the pt-br i18n. It is possible to confirm the proper translation is found at .po and .mo files. I have tested the output of the string sucessfully inside the loop of a regular theme:
_e('Next >'); // Outputs "Próximo »" correctly
I'm not sure if it is happening just with me, so I'd like to have confirmation that this translation is actually happening properly.
#9
@
15 years ago
rodrigovolponi, probably you have a plugin, which calls wp_enqueue_script()
before init
. I looked at the latest version of NextGEN and its code looks alright, so it must be another plugin.
Could you disable all other plugins and try again?
#10
@
15 years ago
- Keywords 2nd-opinion removed
nbachiyski, you are right. I've disabled all the plugins and the one that is causing this problem is "WP Carrousel" (http://wordpress.org/extend/plugins/wp-carousel/).
I'll try to contact the developer and report this problem.
I found some more instances of Close, but that was pretty much it. The patch is attached.