[boost.locale] linguistic case discrimination in translation
Hello Users,
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 https://wandbox.org/permlink/HbnCLQKhHAb3eqZr or even on bottom.
Line 89 ... 94 looks too complicated to me even for the translator which
need an own context of the intend.
I've seen a lot of dating formating flags, but nothings useful for my
use case.
BTW; does boost.locate still using auto_ptr? I had to add the option
'-Wno-deprecated' to rid the warnings...
Thanks,
Olaf
-----------------------8<--------------------------
#include <iostream>
#include
Am 17.08.2018 um 08:21 schrieb Olaf Peter via Boost-users:
Hello Users,
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 https://wandbox.org/permlink/HbnCLQKhHAb3eqZr or even on bottom.
Line 89 ... 94 looks too complicated to me even for the translator which need an own context of the intend.
to make it clear - the best solution would be to have a single format(translate("")) statement.
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 https://wandbox.org/permlink/HbnCLQKhHAb3eqZr 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 % warning_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 https://www.boost.org/doc/libs/1_67_0/libs/locale/doc/html/messages_formatti... translates the entire string, even though it apparently has many words in common in English.
participants (2)
-
Gavin Lambert
-
Olaf Peter