JS strings with "\n" in them marked untranslated
| Project: | Drupal |
| Version: | 6.x-dev |
| Component: | locale.module |
| Category: | bug report |
| Priority: | minor |
| Assigned: | Unassigned |
| Status: | needs review |
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.
| Attachment | Size | Status | Test result | Operations |
|---|---|---|---|---|
| Picture 1.png | 28.83 KB | Ignored | None | None |
| misc.nl_.po_.txt | 1.82 KB | Ignored | None | None |
| untranslated.png | 43.46 KB | Ignored | None | None |

#1
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
When I translate one of the these untranslated strings (containing \n) using the build-in interface it is listed as translated.
#3
This patch fixes this issue.
Please review it.
#4
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?