Am Samstag, 2. Mai 2020, 13:11:55 CEST schrieb Johan Ouwerkerk:
> On Sat, May 2, 2020 at 12:36 PM Eloy Cuadra <ecua...@eloihr.net> wrote:
> > Hi,
> > 
> > There is a widespread problem across many text strings to be translated:
> > some isolated words are gender invariable in English, but not in many
> > languages.> 
> > For example, let's consider this case of a cascade menu:
> >   New
> >   
> >     Folder
> >     
> >     File
<snip>
> What prevents you from arbitrarily re-naming a particular top level
> entry? E.g. if you see "New", why not translate it as though it were
> "Create" if that makes your translation work more naturally?

One thing which might prevent translators being creative here is that the 
original strings appearing in the list of catalogs are not having separate 
context information to them, to make it more obvious how the words are used 
and in which cases. Even more, as without any context information the same 
string if appearing multiple times is mapped to a single string in the 
translation catalogs, and then used in all cases, even when in some languages 
the proper locale version would be different in the different cases. Also when 
it comes to style (capitalization etc.).

That is why there are all the *i18n*c*() call variants in KI18n.

Please take a read of https://api.kde.org/frameworks/ki18n/html/prg_guide.html 
and all the places talking about context. Also see how context is defined in 
non-code data, like ui files.

And yes, most of the code written in recent years seems to have missed to add 
context in the i18n calls. The older among us have failed here to properly 
teach the new generations of contributors about good i18n code. :) Time to 
improve.

So: please use more often *i18n*c*(), especially with single words. And 
default to use UI markers @<major>[:<minor>] in the context.

When it comes to the Qt translation system, the context info is given in the 
optional second parameter to the tr() call (so different order compared to 
KI18n calls), here called "disambiguation" argument.
See https://doc.qt.io/qt-5/qobject.html#tr

Cheers
Friedrich


Reply via email to