Bug 11225

Summary: \n in translation strings should be removed
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: I18N/L10NAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: f.demians, fridolin.somers, gmcharlt, jonathan.druart
Version: Main   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=7688
Change sponsored?: --- Patch complexity: String patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 11225: \n in translation strings should be removed
Bug 11225: \n in translation strings should be removed
[SIGNED OFF] Bug 11225: \n in translation strings should be removed
Bug 11225: \n in translation strings should be removed

Description Katrin Fischer 2013-11-09 19:30:59 UTC
Some strings in the serials module contain linebreaks \n that cause problems in translation.

Example:
"Cannot test prediction pattern for the following reason(s):\\n
\\n
Comment 1 Jonathan Druart 2013-11-12 13:33:47 UTC
Katrin,
What is the problem?
When I update the po file, I get:

msgid "Cannot test prediction pattern for the following reason(s):\\n\\n"

I update the translation:
msgstr "TEST TRANSLATION\n\n"

I install the templates and I get:
        alert(_("TEST TRANSLATION:\n\n")
            + error_msg);

I don't know how we could add a new line without \n.
Comment 2 Katrin Fischer 2013-11-12 13:38:45 UTC
Hi Jonathan,

did you translate the string using pootle or did you do it manually in the text file? It used to be a bug in Pootle causing problems with escaping (bug 4883)

An easy way to solve it, and also not have the confusing \n in translation is concatenating:

_("Cannot test prediction pattern for the following reason(s):") + "\\n\\n"
Comment 3 Jonathan Druart 2013-11-12 14:33:27 UTC Comment hidden (obsolete)
Comment 4 Jonathan Druart 2013-11-12 14:34:55 UTC
(In reply to Katrin Fischer from comment #2)
> Hi Jonathan,
> 
> did you translate the string using pootle or did you do it manually in the
> text file? It used to be a bug in Pootle causing problems with escaping (bug
> 4883)

Yes, manually!

> An easy way to solve it, and also not have the confusing \n in translation
> is concatenating:
> 
> _("Cannot test prediction pattern for the following reason(s):") + "\\n\\n"

Yep, of course. I provided a patch fixing strings introduced by bug 7688 with this way.
Comment 5 Owen Leonard 2013-11-14 14:25:04 UTC
This patch includes several extra parentheses:

error_msg += _("- Frequency is not defined") + "\n"); <-- like that last one
Comment 6 Jonathan Druart 2013-11-14 15:00:00 UTC Comment hidden (obsolete)
Comment 7 Katrin Fischer 2013-11-24 20:58:15 UTC Comment hidden (obsolete)
Comment 8 Kyle M Hall 2013-12-06 13:04:26 UTC
Created attachment 23339 [details] [review]
Bug 11225: \n in translation strings should be removed

Some strings in the serials module contain linebreaks \n that cause
problems in translation.

Test plan:
- Update your po file
- Verify that strings in serials/subscription-add.tt and
  serials/subscription-numberpatterns.tt are present and don't contain
  "\n" character.

Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de>
Template only change, passes all tests and QA script.
Updated po files now contain only the strings and no line breaks.

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
No regressions found. Passes koha-qa.pl and xt.
Comment 9 Galen Charlton 2013-12-06 15:16:13 UTC
Pushed to master.  Thanks, Jonathan!
Comment 10 Fridolin Somers 2013-12-24 09:22:26 UTC
Patch pushed to 3.14.x, will be in 3.14.2