Bug 6988

Summary: formatted strings get split in substrings for translation
Product: Koha Reporter: Gaetan Boisson <gaetan.boisson>
Component: I18N/L10NAssignee: Frédéric Demians <f.demians>
Status: NEW --- QA Contact: Bugs List <koha-bugs>
Severity: enhancement    
Priority: P5 - low CC: pasi.kallinen, vargavind+koha
Version: unspecified   
Hardware: All   
OS: All   
See Also: http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=14459
Change sponsored?: Seeking developer Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:

Description Gaetan Boisson 2011-10-07 13:38:20 UTC
Formatted strings in English (typically with some words in bold) get split around the formatted words. A sentence with one bold word or group of consecutive words thus becomes 3 separate strings.

This behaviour makes it pretty difficult to work on this kind of sentence when translating, as the translator has to search for the strings separately in the translation tool.

Also this forces the translator to follow the same structure as the original for the translated sentence (e.g. normal BOLD normal) which will not necessarily work out in  the target language.

There are some examples in the right column ("notes") on the admin page at Home › Tools › Import Patrons.

For instance in the last bullet point: "must", translated into French, will have different forms according to what the subject is. It's plural here so it would be "doivent", the translated sentence however has "doit" which is a correct translation when the subject is singular. Finding the correct "doit" in the tool to correct the translation is very impractical.

Another similar example can be found at Home › Tools › Patron Card Creator › Manage Images.
Comment 1 Frédéric Demians 2011-10-07 13:54:49 UTC
100% correct.

There is no simple solution. To solve this kind of issues we should have to redesign entirely the way strings to be translated are extracted from templates (and other places).

At a low level of ambition, we should enforce developers not to split sentences into chunks of expressions, avoid adding plural letter ('s') based on variable value.
Comment 2 paxed 2018-11-08 07:14:15 UTC
If there absolutely has to be HTML formatting in the middle of a sentence (eg. a link), one solution is to put the HTML elements in TT directives, so they don't split the sentence into separate msgid strings. For example:

<p>Click [% '<a href="http://example.com">' %]here[% '</a>' %] to do whatever.</p>

Which should show up in the po-files as

msgid "Click %shere%s to do whatever."


(I didn't test the example, so it may not work. Putting the elements in TT variables, and using the variable, definitely does work)