After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 551859 - Text is not sanely translatable
Text is not sanely translatable
Status: RESOLVED OBSOLETE
Product: aisleriot
Classification: Other
Component: general
pre-3.0
Other All
: Normal major
: ---
Assigned To: aisleriot-maint
aisleriot-maint
Depends on:
Blocks:
 
 
Reported: 2008-09-11 19:40 UTC by 28872d13
Modified: 2021-06-02 11:36 UTC
See Also:
GNOME target: ---
GNOME version: 2.27/2.28



Description 28872d13 2008-09-11 19:40:54 UTC
Currently, aisleriot handles some sentences like this:

#. Both %s are card names
#. The first %s is a card name, the 2nd %s a sentence fragment.
#. * Yes, we know this is bad for i18n.
#.
#: ../aisleriot/window.c:1128 ../aisleriot/window.c:1156
#, c-format
msgid "Move %s onto %s."
msgstr "Legen Sie %s auf %s."

This is not only "bad for i18n". It is downright impossible for some languages to translate the strings correctly. It only semi-works even in German because Accusative and Nominative are relatively similar. Please make us sad translators happy by following [1].

[1] http://live.gnome.org/TranslationProject/DevGuidelines/Never_split_sentences
Comment 1 André Klapper 2008-09-11 21:14:10 UTC
in Czech this ends up as
   "Přesunout kárová trojka na kárová dvojka."
for example.
   "Přesunout károvou troujku na károvou dvojku."
would be correct I think.

msgid "Move %s onto %s."
msgstr "Přesunout %s na %s."

msgid "the three of diamonds" (Nominative and Accusative case)
msgstr "kárová trojka" (Nominative case)

msgid "the two of diamonds" (Nominative and Accusative case)
msgstr "kárová dvojka" (Nominative case)

Please fix this soon, even if it does create more strings - at least it's not untranslatable anymore.
Comment 2 Christian Persch 2008-09-11 22:55:52 UTC
(See also bug 50676, bug 113366.)

I'm sorry, but this requires extensive changes to the scheme code, and is out of scope for 2.24.
Comment 3 André Klapper 2008-09-11 23:06:38 UTC
Sure. It's totally fine if we fix it early for 2.25.
Comment 4 André Klapper 2008-11-18 22:03:03 UTC
chpe: Plans to work on this somewhere in the next weeks?
Comment 5 Christian Persch 2008-11-18 23:12:29 UTC
I currently don't plan to work on this for 2.26, no. Sorry.
Comment 6 André Klapper 2009-01-29 01:05:17 UTC
retarget as per last comment
Comment 7 Vincent Povirk 2009-02-28 03:46:13 UTC
I'd like to work on this, but I'm not clear on what we should be doing.

2916 strings consisting of "Move X onto Y." is not an option I'm willing to implement.

Would it be OK with everyone if we made it a policy to only split sentences of the form "Move X onto Y.", where X and Y are both names of cards, and split those into "X" and "Move %s onto Y."?

That means we would split "Move the two of diamonds onto the three of diamonds." into "the two of diamonds" and "Move %s onto the three of diamonds. However, we would not split "Move the ace of diamonds onto an empty foundation slot."

To enforce this, we would deprecate the (get-name) function in favor of calls like (hint-move-to-foundation source-slot num-cards dest-slot). That's more information than is necessary to form the string (and simpler calls would likely be needed in some cases), but it's also potentially useful for bug 365585.
Comment 8 Callum McKenzie 2009-03-07 20:36:33 UTC
See 

http://mail.gnome.org/archives/gnome-i18n/2003-May/msg00170.html

for the discussion leading to the current "solution".

In short: we knew it was a disaster when we implemented it, but having thousands of extra strings was deemed worse.

A visual indicator has always struck me as the cleanest solution to this problem (not that I ever got around to implementing it when I was maintaining aisleriot).
Comment 9 André Klapper 2009-03-08 22:39:43 UTC
What about having each %s string twice and marked with context, like "this is the name of the card X as in the sentence "Move X onto Y""" and "this is the name of the card Y as in the sentence "Move X onto Y""? Not perfect but probably much better, plus only 54 additional strings (if i get it right).

Just also have to make sure that there's no nominative usage of X or Y, or mark that with another context (another 54 strings).
Comment 10 Alexey Rusakov 2009-06-18 21:23:47 UTC
I may sound a bit too global, but the good solution of the problem would be to introduce grammatical cases to gettext. In this very case it would be enough (without any patches to gettext :) to produce an Accusative form for each card value (amounting to 9 strings) and a Genitive form for each card suit (amounting to other 4 strings). The problem of combinatorial explosion of strings is then solved in a natural way, although the code that generates the string "Move X-value X-suit onto Y-value Y-suit" becomes a bit more complicated.
Comment 11 Christian Persch 2009-07-09 11:17:56 UTC
Not a blocker (won't get done for 2.28).
Comment 12 Christian Persch 2011-04-25 12:05:14 UTC
Mass-moving only open aisleriot bugs to the new product. Search for "aisleriot-mass-move" to filter them.
Comment 13 Ihar Hrachyshka 2011-09-24 14:19:53 UTC
Any plans to fix this in any near future? What we have now is not localizable for my language. Please at least use context solution. Please pay attention to i18n since it's one of GNOME claimed priorities.
Comment 14 Vincent Povirk 2011-09-24 16:10:11 UTC
No, no one is working on this.

I'm happy to implement whatever logic we need in the scheme code and purge (get-name), but someone who understands the problem and understands gettext needs to do the heavy lifting. Right now, all we have in scheme is a function that takes an English string and spits out a localized string. To change the translation based on grammatical cases, we'd need a different kind of translation function in our code and the ability to scan for it when generating .po files. But I don't know how to do that or what features translators need.

And no one commented on my suggestion of splitting "Move %s onto %s" strings into "%s" (which would have to be used only for direct objects, I guess) and "Move %s onto a specific card that is named here." It's a bit of hassle for translators, but I could implement that without help, if it's actually good enough. I have no way of knowing if it is.
Comment 15 Ihar Hrachyshka 2011-09-24 16:18:27 UTC
I find your solution ok for translators. I'm not sure if any languages in the world would have problems with this, but at least these messages would be translatable in most European and Slavic languages.

Is it possible to implement it for 3.4 release?
Comment 16 Vincent Povirk 2011-09-24 16:36:23 UTC
Should be possible, but it's a matter of putting in a new system and then modifying every existing game. So it may be that you have the tools to do the translation correctly but some games do it the old wrong way in 3.4.

Are strings like "Move %s onto an empty foundation slot." OK? I'd rather not have 54 strings for each type of non-card you can move something to, as I'm guessing there are around 10 of them. (If we use a card name anywhere else in a sentence, I figure we WILL need 54 strings for it, but I'm hoping that case is more rare.)
Comment 17 Ihar Hrachyshka 2011-09-24 16:44:19 UTC
If you are to use 'Move %s onto an empty foundation slot.' message then you should create special gettext context for each card name which substitutes %s. Basically, use should add the whole message where this card name occurs, in msgctxt. So for each message where you use this kind of substitution, you will need to have +54 messages. It's cumbersome, but it works for translators.
Comment 18 Vincent Povirk 2011-09-24 17:00:29 UTC
I'm not familiar with msgctxt. It sounds like it would require wrapping a new localization function for use in the scheme code and doing whatever needs to be done to make sure we can find those strings in the scheme code. That requires someone with a better understanding of the tools than I have. What I can do is avoid splitting those sentences, so you end up with 54 strings that are a full sentence.
Comment 19 Ihar Hrachyshka 2011-09-24 17:10:01 UTC
Actually, though it sounds scary, there is nothing wrong with un-splitted sentences. On the opposite, this is the recommended way to do it. Of course, it will raise the number of messages to translate dramatically (52x52?..), but:

1. it will be the best solution for every language on the planet.
2. translators are better to use gettext editors with support for translation memory and suggestions. If done so, no big problems to update translations with un-splitted messages then.

But since this is a major change, I would suggest to raise the question among gnome-i18n@ and maybe some interested developers.
Comment 20 Vincent Povirk 2011-09-28 09:25:55 UTC
I need someone to tell me whether the master branch is frozen, because apparently I'm not smart enough to understand https://live.gnome.org/Schedule.
Comment 21 Ihar Hrachyshka 2011-09-28 09:36:30 UTC
It was branched for release (gnome-3-2) and hence it's not frozen anymore (gnome-3-2 is frozen from now on).
Comment 22 Christian Persch 2011-09-28 12:02:04 UTC
Yes, master is open for all commits; only gnome-3-2 branch is (string, UI, feature) frozen.

I guess it would be better to expose a new C function to the scheme code, that takes the cards as input and returns the corresponding string. That way we don't have to deal with msgctxt translations in scheme.
Comment 23 André Klapper 2011-09-29 09:02:02 UTC
(In reply to comment #18)
> I'm not familiar with msgctxt.

https://live.gnome.org/TranslationProject/DevGuidelines/Translation%20contexts and https://live.gnome.org/TranslationProject/DevGuidelines/Use%20comments hopefully explains a few things.
Comment 24 Vincent Povirk 2011-11-02 03:27:18 UTC
So, I did this once before but then backed it out because I was confused and thought we were in code freeze. Anyway, I have added a new set of hint functions (well, mostly ONE hint function, hint-move) for developers to use in aisleriot games so that "drag and drop" hints can be translated properly. This is not using msgctxt only because I personally do not have the skills to do that. That may change shortly if Christian decides to step in, so you may want to wait a bit before translating the new strings.

Christian, please feel free to tamper with the inner workings and the return value of hint-move. If you want it to return a different type of hint, or call into some new C entry point, go ahead. Also, feel free to delete hint-get-dest-format. I promise not to rely on the way hint-move currently works or treat the result as anything other than a token to be returned from get-hint. I made hint-move take a set of piles and a location in the source pile so that, once games are using this function, we don't have to modify them AGAIN if/when we want hints to use animations or arrows or something. It uses the slot tag to determine the type of empty slots. The hint-click function is a similar concept, but I'm probably not going to convert things over to it.

The commit id for this change is f9c67a2fcc2372f008538df5cd7e85b6345464c8.
Comment 25 André Klapper 2011-11-25 11:49:46 UTC
http://mail.gnome.org/archives/gnome-i18n/2011-September/msg00385.html explains how to add comments in Scheme. The entire thread was actually about this bug report.
Comment 26 Vincent Povirk 2013-05-05 22:30:30 UTC
I've removed every use of (get-name) from every aisleriot game and made the function private in ab0b57d5a92900a760384d8a0d8dbd676e725763. I believe this should make it possible to translate all the hint strings correctly, and if any problems remain we should be able to fix them in (get-hint).

There were some uses of get-name that weren't for "Move x onto y." type strings, and those have been replaced with full strings that include the card names.

The strings for individual card names are still present, but they will only be used in sentences like "Move ~a onto the ace of clubs.", "Move ~a onto the foundation." or "Move ~a onto an empty foundation slot."

It'd be nice to add a comment to that effect to the individual card name strings. Is there an easy way to apply it to all of them?
Comment 27 Christian Persch 2013-05-05 22:43:02 UTC
Unfortunately only way the intltool extractor is going to pick up comments if it's duplicated before each string.
Comment 28 GNOME Infrastructure Team 2021-06-02 11:36:02 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to GNOME's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.gnome.org/GNOME/aisleriot/-/issues/102.