! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Strings in time_out_countdown_seconds_to_string
Status:
RESOLVED: FIXED
Product:
Xfce4-time-out-plugin
Component:
General

Comments

Description Gabor Kelemen 2009-07-24 23:32:05 CEST
The Time left: strings from time_out_countdown_seconds_to_string() are a terrible experience to localize, mostly because of the lack of ngettext, see here: http://live.gnome.org/TranslationProject/DevGuidelines/Plurals.

I'll come up with a patch soon.
Comment 1 Diego Ongaro 2009-07-25 05:13:22 CEST
Reassigning to xfce-time-out-plugin
Comment 2 Gabor Kelemen 2009-07-27 22:23:00 CEST
Created attachment 2467 
Use ngettext, simplify logic

This seems to do the trick. The pot file contains now a lot fewer strings :).
The patch itself uses some string surgery, which is usually not welcomed, but there aren't really any other ways to make two components of a string plural, independently from each other.
Comment 3 Florian Rivoal editbugs 2010-12-10 03:20:07 CET
I need opinions from translators about know how to solve this.

The problem is that a few strings contains several words for which the  
plural form need to be handled, but the translation system can only  
support plurals well when only one word has a varying number.

There are a few strings, but the typical one is "Time left: %d hours %d  
minutes %d seconds"

Before the patch, only languages that have a form for 1, a form for  
several, and no other form, are well supported. After the patch, any kind  
of plural is supported. On the other hand, because the patch splits the  
string to be able to do that, it becomes impossible to reorder words or to  
insert link words.

In the general case, both solutions may cause problems. But I am wondering  
about this particular case, with the particular strings we are dealing  
with here, for the languages we are supporting.

Is there any language that could not be properly translated before the  
patch that becomes possible after it? Is there any language that was  
properly translated before the patch that will not be after?
Comment 4 Gabor Kelemen 2010-12-10 08:51:25 CET
"it becomes impossible to reorder words or to insert link words."

Translators are supposed to reorder words of time units in these strings: 
_("Time left: %s %s %s")

I hope you too are aware of the possibility to translate this as "%3$s %1$s %2$s", if one wanted to see the order as seconds hours minutes[1].

It might become necessary to use the C_ macro[2] to differentiate the context of "Time left: %s %s" in the cases of hours - minutes, minutes - seconds and hours - seconds so that one can choose to reorder only some of these), but I'd do it only if really needed i.e. asked in another bug.

Also, I don't see any link words here, so that's probably not a problem.

"Is there any language that could not be properly translated before the  
patch that becomes possible after it? "

Yeah, for example the ones with more than two plural forms, see the Gnome wiki in my original report.

[1]: http://www.gnu.org/software/gettext/manual/gettext.html#c_002dformat
[2]: http://library.gnome.org/devel/glib/stable/glib-I18N.html#C-:CAPS
Comment 5 Florian Rivoal editbugs 2010-12-10 16:33:14 CET
Right. I must have been tired when I first read your patch, and somehow though it didn't allow reordering properly. I now see it does, and link words are handled just fine too: "%3$s and %1$s with%2$s is the time left" is possible, if any language needs that.

As for the use of the C_ macro, or the possible need to translate any of hours, minutes, seconds differently whether they appear alone or combined, I agree that this can wait for a separate bug to show the actual need.

As for asking whether it helps with some languages, I know it does in the general case. I was just wondering if it was the case for this particular string, with the particular languages we are supporting. The reason being that if not, I'd despite the current code being obviously bad, I didn't want to invalidate the work of the translators that had dealt with it anyway.

One more person has now complained, so I'll go ahead and apply your patch.
Comment 6 Florian Rivoal editbugs 2010-12-11 16:07:14 CET
Patch applied, thanks. This will be available in the next release.

Bug #5611

Reported by:
Gabor Kelemen
Reported on: 2009-07-24
Last modified on: 2010-12-11

People

Assignee:
Florian Rivoal
CC List:
1 user

Version

Version:
0.1.1 or older

Attachments

Use ngettext, simplify logic (10.94 KB, patch)
2009-07-27 22:23 CEST , Gabor Kelemen
no flags

Additional information