JS strings with "\n" in them marked untranslated

Sutharsan - February 3, 2008 - 15:04
Project:Drupal
Version:6.x-dev
Component:locale.module
Category:bug report
Priority:minor
Assigned:Unassigned
Status:needs review
Description

D6-RC3 translated using the l10n_server translation interface.
All po.files are is uploaded during installation
Three strings are reported not to be translated (attached untranslated.png) despite the fact that their translation is available in the .po file (attached).

Upon investigation I have found the following:
The three string are the only strings which contain \n in the source string. To find these strings search for strings containing "\\\n" using the search tab on the Translate interface page.
When importing the po file the same string but without "\n" is listed in the translation interface (attached translated.png).

Source string in ./misc/drupal.js:
var message = Drupal.t("An HTTP error @status occurred. \n@uri", {'@uri': uri, '@status': xmlhttp.status });
which is the same as the source text in the .po file

js translation file (./sites/default/files/languages/nl_a1c4a100ca41f95b001b4f0bcda9f2f6.js:Drupal.locale) contains:
"An HTTP error @status occurred. \n@uri": "Een HTTP-fout @status is opgetreden. \r\n@uri"
which is the same as source and translation in the .po file

I can not force these errors to check if they get translated or not.

It looks like all t() translated text gets stripped of \n but these javascript strings keep their \n. Causing these to be (reported as) untranslated.

AttachmentSizeStatusTest resultOperations
Picture 1.png28.83 KBIgnoredNoneNone
misc.nl_.po_.txt1.82 KBIgnoredNoneNone
untranslated.png43.46 KBIgnoredNoneNone

#1

Gábor Hojtsy - February 4, 2008 - 10:49
Title:JavaScript strings containing "\n" not translated» JS strings with "\n" in them marked untranslated
Priority:normal» minor
Status:active» postponed (maintainer needs more info)

Updated title to reflect that the strings are in fact translated, but marked as untranslated for some reason still. So this looks like a minor bug somewhere in the search code.

Since the JS translations are fine, there is evidence that the translations are in the database and are associated to the proper source strings. What about the editing pages? What if you edit the translations for one of these strings? Does it still present empty textarea(s) or the translations? Let's figure out if only the overview page is at error.

#2

Sutharsan - February 4, 2008 - 18:51

When I translate one of the these untranslated strings (containing \n) using the build-in interface it is listed as translated.

#3

Takafumi - October 24, 2008 - 10:33
Version:6.0-rc3» 6.x-dev
Status:postponed (maintainer needs more info)» needs review

This patch fixes this issue.
Please review it.

AttachmentSizeStatusTest resultOperations
locale_patch_1.txt766 bytesIgnoredNoneNone

#4

Gábor Hojtsy - October 24, 2008 - 15:01

Well, there are non-JS strings with \n which work, and also, \r (0x0d) and other special chars could just as well appear. A not too good but working example is the bbcode help translation: http://cvs.drupal.org/viewvc.py/drupal/contributions/modules/bbcode/po/h... (yes, this is a monster).

Sutharsan, could you please test the patch?

 
 

Drupal is a registered trademark of Dries Buytaert.