Bug 6988 - formatted strings get split in substrings for translation
Summary: formatted strings get split in substrings for translation
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: I18N/L10N (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement (vote)
Assignee: Frédéric Demians
QA Contact: Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-10-07 13:38 UTC by Gaetan Boisson
Modified: 2018-11-08 07:14 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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)