Bug 4883 - Problem translating \n (newline) with pootle.
Summary: Problem translating \n (newline) with pootle.
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: rel_3_2
Hardware: All All
: PATCH-Sent (DO NOT USE) trivial
Assignee: Chris Cormack
QA Contact: Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-10 14:11 UTC by Katrin Fischer
Modified: 2012-10-25 22:52 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:


Attachments
pootle screenshot (18.28 KB, image/png)
2010-06-10 14:11 UTC, Katrin Fischer
Details
patch: remove \n from opac files (2.47 KB, patch)
2010-06-17 20:00 UTC, Katrin Fischer
Details | Diff | Splinter Review
patch. remove \n from staff files (7.56 KB, patch)
2010-06-17 20:01 UTC, Katrin Fischer
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Katrin Fischer 2010-06-10 14:11:20 UTC
Created attachment 2235 [details]
pootle screenshot

There is a problem with \n (newline) and pootle.

At the moment there is no possibility to translate \n (newline) with pootle.
I think newlines and tabs might be also confusing for new translators.

An example:

Pootle shows: (see screenshot)
- Budget amount cannot be blank\n
- Etatsumme darf nicht leer sein\n

--------------------

po file: \\n 
#. SCRIPT
#: /home/katrin/kohaclone/koha-tmpl/intranet-tmpl/prog/en/modules/admin/aqbudgets.tmpl:84
msgid "- Budget amount cannot be blank\\n"
msgstr "- Etatsumme darf nicht leer sein\\n"

--------------------

Poedit:
- Budget amount cannot be blank\\n
- Etatsumme darf nicht leer sein\\n

I think the best solution is to removes tabs, newlines etc. from strings that need translation.

\\n does not work and is shown behind the translated text as \\n.
Comment 1 Katrin Fischer 2010-06-10 21:39:01 UTC
I talked to Chris and changed my mind about the best solution:

tmpl_process3.pl needs to remove them, when it creates the po file.

(23:10:59) chris: ie, you dont translate them
(23:11:13) chris: so they dont need to be in the string
(23:11:37) kf: but if you remove them, how will they get back in?
(23:11:51) chris: the po file works like this
(23:12:00) chris: it takes the english line, finds that in the template
(23:12:16) chris: and switches out the english words for the translated words
(23:12:24) kf: ah, so you work around the rest of the template
(23:12:27) chris: if you dont have the \n in the english
(23:12:45) chris: then it will find the words without them and change them .. and the \n will stay just fine in the template
(23:12:53) chris: make sense?
(23:13:17) chris: its actually better that way, cos then if you have the string twice, once with \n once without
(23:13:25) chris: you now only need to translate it once
(23:13:35) kf: sounds really better
(23:13:53) kf: im done with opac ( removing..) but they are really a lot of them in inranet
(23:17:10) chris: problem is, they will all come back
Comment 2 Frédéric Demians 2010-06-11 07:45:14 UTC
> tmpl_process3.pl needs to remove them, when it creates the po file.

There are several difficulties :

  - tmpl_process3.pl is a black box very complex to improve. The way it
    parse is tricky and un-extensible (for me). Whatever, if templates
    are switched from HTML::Template to Template::Toolkit, .po
    generation will have to be entirely recoded.
  - Carriage return inside text is error prone for translator. It should
    be forbidden. It mixes text with formating which should be avoided at
    all.
Comment 3 Katrin Fischer 2010-06-11 07:56:28 UTC
Hi Frederic, thx for looking into this.

> - Carriage return inside text is error prone for translator. It should
>   be forbidden. It mixes text with formating which should be avoided at
>   all.

I have a tested patch ready for OPAC that I can send later. 

Intranet will take a bit more work, but if you think it makes sense to remove them I can work on that.
Comment 4 Katrin Fischer 2010-06-17 20:00:56 UTC
Created attachment 2249 [details] [review]
patch: remove \n from opac files
Comment 5 Katrin Fischer 2010-06-17 20:01:36 UTC
Created attachment 2250 [details] [review]
patch. remove \n from staff files
Comment 6 Galen Charlton 2010-06-19 12:10:29 UTC
Patches pushed.  Please test and close.
Comment 7 Katrin Fischer 2010-06-19 15:10:48 UTC
Tested successfully, closing bug.