Bug 6958

Summary: Missing spaces in translated templates
Product: Koha Reporter: Katrin Fischer <katrin.fischer>
Component: I18N/L10NAssignee: Frédéric Demians <f.demians>
Status: CLOSED FIXED QA Contact: Bugs List <koha-bugs>
Severity: critical    
Priority: PATCH-Sent (DO NOT USE) CC: chris, koha.sekjal, paul.poulain
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 6958 : Fix for leading spaces being stripped on translation
[SIGNED-OFF] Bug 6958 : Fix for leading spaces being stripped on translation

Description Katrin Fischer 2011-10-02 21:14:24 UTC
I noticed that especially in breadcrubs and texts that contains links and normal text spaces are missing from the po file and so from the translated templates.

Examples: 
1) Breadcrumbs on patron module start page:
English: Start > Patrons
German: Start> Benutzer

The po file for the first part of the breadcrumbs looks like this:
[...]
#: intranet-tmpl/prog/en/modules/errors/405.tt:10
#, c-format
msgid "Home"
msgstr "Start"

When changing "Start" to "Start " the templates look correct.

This is only an example, the spaces before the > are missing in general on all breadcrumbs.

2) Fines on patron account (check out tab)
English: Fines: Patron has Outstanding fines of 1.00. Make Payment
German: Gebühren:Benutzer hat offene Gebühren in Höhe von 1.00. Zahlung

The space after Fines: is missing.

The po fiole looks like this:
#: intranet-tmpl/prog/en/modules/circ/circulation.tt:574
#, c-format
msgid "Fines:"
msgstr "Gebühren:"

#: intranet-tmpl/prog/en/modules/circ/circulation.tt:569
#: intranet-tmpl/prog/en/modules/circ/circulation.tt:574
#, c-format
msgid "Patron has "
msgstr "Benutzer hat "

There are lot of other examples.
Comment 1 Chris Cormack 2011-10-03 20:39:40 UTC
Hmm it looks like its the replacement when putting the .po file back into the templates that is the problem.

Investigating more
Comment 2 Chris Cormack 2011-10-03 21:12:17 UTC
Right here the problem

</a> &rsaquo; Error 405</div>
Becomes
</a>&rsaquo; Fehler 405</div>

Tracking down why now
Comment 3 Frédéric Demians 2011-10-04 07:29:31 UTC
> Tracking down why now

I've tried without success. It seems that stings containing &rsaquo; are parsed as a TEXT_PARAMATRIZED tokens, which is false.
Comment 4 Chris Cormack 2011-10-04 07:32:54 UTC
I have a patch which adds the space back in. Katrin is testing it more, to make sure it has no unintended side effects. Its not a very elegant solution but seems to work.

Ill attach it to the bug once Katrin has a little more time to test
Comment 5 Chris Cormack 2011-10-04 20:37:49 UTC Comment hidden (obsolete)
Comment 6 Chris Cormack 2011-10-04 20:38:43 UTC
Please test a lot, it is pretty harmless only adds whitespace if needed.
Comment 7 Katrin Fischer 2011-10-05 05:59:14 UTC
Created attachment 5712 [details] [review]
[SIGNED-OFF] Bug 6958 : Fix for leading spaces being stripped on translation

Tested on 5.4.x with complete German po files.
Comment 8 Ian Walls 2011-10-06 13:46:20 UTC
The logic in this patch looks sound; the same basic functionality is preserved, with an expansion in the event that the string starts with leading spaces, which are now preserved.  Logic is actually now much more readable, so improvement there.  Marking as Passed QA.
Comment 9 Chris Cormack 2011-10-06 20:47:56 UTC
Pushed, please test