[Openstack-i18n] Including the final : with strings

Douglas Fish drfish at us.ibm.com
Fri May 2 14:05:50 UTC 2014

Am I correct in understanding that single words are the biggest candidates
for using contextual marking?

In exchanges with a French translator I've heard that the word "None" is
often problematic when it's a standalone word.  If I understood and recall
correctly "None" might be masculine or feminine depending on the context
its used, so for a high quality translation, a different word should be

Taking a look at our translation
 it looks like there are 30 or 35 instances of the words "None" in
Dashboard over 8 or 9 screens.

Are you envisioning that the developers put in 30 or 35 different
contextual markers so that the translators can choose which translation to
use for each word?  or maybe 8 or 9 markers is the right granularity?  or
maybe there is another way the markers should be used?

Doug Fish

From:	Yves-Gwenaël Bourhis <yves-gwenael.bourhis at cloudwatt.com>
To:	openstack-i18n at lists.openstack.org,
Date:	05/02/2014 04:15 AM
Subject:	Re: [Openstack-i18n] Including the final : with strings

Le 30/04/2014 22:15, Douglas Fish a écrit :
> Thinking about the user of contextual markers a bit:  If the same string
> exists with two different contextual markers its going to get put into
> PO file twice.  Once with each unique contextual marker.  Contextual
> markers won't reduce the amount of stuff that needs to be translated.

Here is a quick way to check if a translation exists without contextual

(.venv)yves at paradox ~/openstack/horizon $ python manage.py shell
Python 2.7.4 (default, Sep 26 2013, 03:20:26)
Type "copyright", "credits" or "license" for more information.

IPython 2.0.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from django.utils.translation import activate, gettext

In [2]: activate('fr')

In [3]: print gettext('Start')

(the same can be done with "from django.utils.translation import
pgettxt") and use pgettext(context_message, string) to check if a
translation exists "with 'context_message'")

As you see, in the example above the string is already translated
without a context, so we should not add a context to it if we want to
keep the existing translation, "unless" it will be used in another
context (i.e.: here this word is used to "Start" an instance, but if you
use it in a sentence like "Please choose a network to be configured at
Start", "Start" in French would be "démarrage" and if it where
introduced as a variable in the sentence the existing translation would
fail. (Even the word "Démarrer" is wrong "inside" a sentence where it
should be "démarrer" (capital letter only at the beginning of a sentence
or for Nouns, and "Démarrer" is a verb not a Noun.
Even worse: each language has it's own rules when it comes to Nouns,
Verbs, etc... so I admit that for the coder it's a situation where
he/she can pull his/her hair off to know if a contextual marker is
required or not.

So as long as a word has no contextual marker and is already translated
and also used always in the same context, indeed, it does not need a
contextual marker if we do not want to duplicate it in the PO file.
But... e.g. in French (and even more in other languages), "Start" can be
"Démarrer", "Démarrage", "Début" depending on the context.
This context is guessable by the translator if the word is in a full
sentence, but in sentences using the word alone as a variable there is
no way the translator can guess the context when he sees the word alone.
Also, a word alone can generally not be added to an existing string,
because for many languages, a word which starts with a capital letter
inside a sentence is just wrong if the word is not a Noun. Only a
contextual marker allows the translator to know where it is placed.

So indeed, you are right saying that adding contextual markers can lead
to adding an already existing string. If this string is long or always
used in the same context, then the contextual marker is not necessary.
However if it's a short word used as a variable inside a string, in many
languages without a context it will work in "one" place in the whole
code and fail in all the others.
If it's a short word not used as a variable in another sentence, and
already translated, then we will not add the contextual marker to be
able to reuse the existing translation.

The difficulty I admit it is to know if a string is already used in the
same context with or without a contextual marker. This leads to
searching for the string to reuse the same contextual marker if it
exists, or to check if it will be used in the same context if it is
translated without a contextual marker... I admit it can give some
head-aches :-)

Yves-Gwenaël Bourhis

Openstack-i18n mailing list
Openstack-i18n at lists.openstack.org

More information about the Openstack-i18n mailing list