%1 minutes/hours needs plural forms

Bug #1561457 reported by GunChleoc on 2016-03-24
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Stellarium
Wishlist
Alexander Wolf

Bug Description

If possible, please fetch the following strings with ngettext:

   Next update: %1 minutes

plugins/Satellites/src/gui/SatellitesDialog.cpp:485 plugins/Supernovae/src/gui/SupernovaeDialog.cpp:174 plugins/Novae/src/gui/NovaeDialog.cpp:171

    Next update: %1 hours

plugins/Satellites/src/gui/SatellitesDialog.cpp:487 plugins/Supernovae/src/gui/SupernovaeDialog.cpp:176 plugins/Novae/src/gui/NovaeDialog.cpp:173

Thanks!

Related branches

gzotti (georg-zotti) wrote :

Those are already in plural. What do you want to change? If it says "Next update: 1 hours", I hope users can live with that.

GunChleoc (gunchleoc) wrote :

In Scottish Gaelic, the plural goes like this:

2 hours = 2 uair
3 hours = 3 uairean
...
11 hours = 11 uair

etc.

If you want to learn more about plural forms in the languages of the world, look here:

https://localization-guide.readthedocs.org/en/latest/l10n/pluralforms.html

tags: added: i18n
gzotti (georg-zotti) wrote :

Sure, many languages have special forms. Then how should the string "hours" (meaning "hour" in plural form) be translated into a single expression in Scottish Gaelic? How much laughter and ridicule can we expect when a Scottish user sees "11 uairean" in an unimportant status message on his screen?

We should also have to cater for dual forms and the "small-group" (2-4) plural aspects in some slavic languages.

Or maybe not. Stellarium is astronomy software, not so much linguists' playground.

GunChleoc (gunchleoc) wrote :

I don't really see what the problem is. Stellarium uses gettext for translation, so all you need to do is replace _("Next update: %1 hours") with ngettext("Next update: %1 hour", "Next update: %1 hours"). Done - unless you need to interface between C/C++ and a scripting language, then you will also need to pipe the command though. You won't have to implement the plural form rules yourself though!

How embarrassing would you find it it the English language user interface was full of grammar errors.e.g. how would you like it if the English string was replaced by "%1 hour"? Wouldn't you be itching to correct it? I have also seen a number of plural-form workarounds for the English source strings. So, English speakers would also get a better user experience out of the use of ngettext.

And if you think that Slavic languages are small, look at how big the territory of the fomer USSR is, and then think about how many people live there. And I'm sure that some people there will be interested in astronomy as well ;)

GunChleoc (gunchleoc) wrote :

Small correction: the syntax for the ngettest invocation is

    ngettext("Next update: %1 hour", "Next update: %1 hours", <variable_name>)

I forgot the conrolling variable ;)

Alexander Wolf (alexwolf) wrote :

We have a small problem - Stellarium don't uses gettext for translation.

Changed in stellarium:
status: New → Confirmed
Changed in stellarium:
importance: Undecided → Wishlist
GunChleoc (gunchleoc) wrote :

Oh I see - I just assumed that you did because of the PO file format that translators see. So, not a simple fix then.

Would you be interested in changing the translation system to gettext? If so, I might have a look at it myself eventually and do the legwork.

Alexander Wolf (alexwolf) wrote :

We avoided a gettext requirement some time ago because on Windows it caused problem and currently we use Qt's tools for translation. Yes, we use POT and PO files for saving of backward compatibility and for using Rosetta tool, but we converting it to QM for using within Stellarium. I guess we should investigate plural forms for Qt.

GunChleoc (gunchleoc) wrote :

I have seen plural strings in QT someplace, but I don't remember the syntax. I'll have a look.

Changed in stellarium:
assignee: nobody → GunChleoc (gunchleoc)
GunChleoc (gunchleoc) wrote :

OK, this is the documentation I found:

https://doc.qt.io/archives/qq/qq19-plurals.html

http://doc.qt.io/qt-5/i18n-source-translation.html

Their usage example is:

    int n = messages.count();
    showMessage(tr("%n message(s) saved", "", n));

The QT version on my Ubuntu is too old to work on this, and it won't update easily. So, I can only start working on this once Ubuntu 16.04 is out, when an update will make sense.

Alexander Wolf (alexwolf) wrote :

Any progress?

GunChleoc (gunchleoc) wrote :

Not much - I sort of found the place in the C++ code but I'm still a bit puzzled by the differences between the QT and gettext formats. I also have my fingers in too many pies at the moment.

Alexander Wolf (alexwolf) wrote :

Any news for the issue?

GunChleoc (gunchleoc) wrote :

Sorry, I keep chasing my tail with too many projects and I have no idea when I will get around to this. The 2 issues I ran into with my implementation attempt:

1. QT and gettext use a different amount of arguments for their pluralized functions, so we'll need to map this somehow

2. I still have to understand how the strings are extracted

Alexander Wolf (alexwolf) wrote :

Please see cmake script in the po/ directory - we use xgettext to extract translations, gettext to update translations and lconvert to convert into qm format.

Changed in stellarium:
assignee: GunChleoc (gunchleoc) → Alexander Wolf (alexwolf)
milestone: none → 0.17.0
status: Confirmed → Fix Committed
GunChleoc (gunchleoc) wrote :

Thank you so much for fixing! :)

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers