Variable in Translation

Asked by Tobias Bannert on 2016-12-22

Hi,

with what will the variable in the following string replaced?

This %s has several terminals open. Closing the %s will also close all terminals within it.

One replacement is »Window« but what else will be used?

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Terminator Edit question
Assignee:
No assignee Edit question
Last query:
2016-12-22
Last reply:
2016-12-23

From the code:
        secondary = Gtk.Label(label=_('This %s has several terminals open. Closing \
the %s will also close all terminals within it.') % (reqtype, reqtype))

So it is the same in both positions. reqtype can be either window or tab.

Manfred Hampl (m-hampl) said : #2

I see a certain weakness in the general setup of the texts here:

In English language there is just one definite article "the". No matter what word is inserted (window or tab), it fits.
Other languages have different definite articles for different genders. e.g. in German it is der, die and das (and the flexed versions des, dem, den). So including an article in the fixed text can pose a problem.

The current proposal seems to be able to solve the case here:
"Mehrere Terminals sind in %s geöffnet. Diese Terminals werden beim Schließen von %s ebenfalls geschlossen"
can be filled with either "diesem Fenster" as well as "diesem Tab" or "diesem Reiter".

Or use
"Mehrere Terminals sind in diesem %s geöffnet. Diese Terminals werden beim Schließen von diesem %s ebenfalls geschlossen"
can be filled with either "Fenster" as well as "Tab" or "Reiter".

In any case the translation of this text has to be done in close cooperation with the translation of the words 'window' and 'tab' in certain other records of the translation for terminator.

It might be possible that other languages require different cases or forms for the two words to be filled in here, which is not possible with a construct like "_('This %s has several terminals open. Closing the %s will also close all terminals within it.') % (reqtype, reqtype))" with two times the same parameter value!

Hi Manfred, as a uniglot (as opposed to a polyglot) the construction and rules of foreign languages is rather opaque to me.

I'm not sure of a way that would allow adaption for articles/cases/genders etc. The only one I can think of is to remove the substitution placeholders, and hard code the separate strings in their entirety for each possibility (i.e. one for window, one for tab, etc).

Or can you point me to some other project which has resolved this without resorting to ever increasing counts of translation strings?

Manfred Hampl (m-hampl) said : #4

@Stephen:

I am definitely not polyglot, only bi-glot ;-)

No idea how other projects solve such problem.

My opinion:
If there are only two variants (window and tab), then coding two separate sentences would be the easiest solution and would allow for any language rules.

You need the translation for the word to be filled in anyhow, so I do not see much benefit in trying to work with bits and pieces to be put together like puzzle stones.
I just wanted to point out, that English language is quite easy, and the two occurrences of the works 'window' and 'tab' are identical in the sentence to be translated. You cannot expect that this is the case in all languages.
One (not really good) possibility for a German translation would be
"Dieses Fenster hat mehrere Terminals offen. Das Schließen des Fensters schließt auch alle Terminals darin."
As you can see it's "Fenster" once, and "Fensters" in the second occurrence (comparable to "window" and "window's" in English).

Tobias Bannert (toba) said : #5

:-)

I would like to add a translation without the variables but Launchpad gives me an error.
I found a solution for this two words:
Im %s sind mehrere Terminals geöffnet. Beim Schließen des %ss werden alle Terminals geschlossen.

Im Fenster – Im Reiter
des Fensters – des Reiters

I Hope the »s« added on »%s« does not make some Problems.

But the best way is to add complete sentences in the code. This is how other projects handle this.

I changed the translation to use absolute sentences. The updated strings should appear some point soon.

Can you help with this problem?

Provide an answer of your own, or ask Tobias Bannert for more information if necessary.

To post a message you must log in.