Boost logo

Boost Users :

Subject: Re: [Boost-users] [boost.locale] linguistic case discrimination in translation
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2018-08-19 23:45:41

On 17/08/2018 18:21, Olaf Peter wrote:
> I like to join two translation into a single one using the word 'and'
> if the code path require it, e.g. translation 1 is: "{1} error" and
> translation 2 is: "{1} warning" >
> if the relevant err/warn counter are both != 0 I want to combine this
> statement using the mentioned 'and'. I guess, an example teels more
> than this here: >
> see or even on bottom.
> Line 89 ... 94 looks too complicated to me even for the translator
> which need an own context of the intend.
One of the cardinal rules of translation is to not translate fragments,
since different languages can have different sentence structures and
word orderings.

So you should probably print exactly one of:

   - format(translate("{1} generated.")) % error_message
   - format(translate("{1} generated.")) % warning_message
   - format(translate("{1} and {2} generated.")) % error_message %

If you're not using your error_message generation elsewhere you should
have the entire thing inlined in here rather than trying to factor it
out. Factoring out "common" sentence fragments rarely ends well.

Even the cases above where it appears that the format string for
warnings and errors is the same, ideally should not use a common
constant (although it is unavoidable in this case, unless you do inline
it all so that they become unique), since it's plausible that some
language might require the word 'generated' to have different emphasis
depending on whether it is referring to warnings or errors.

Note how the example of the plural-form translate in
translates the entire string, even though it apparently has many words
in common in English.

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at