Re: proposed string overhaul for battstat applet



tor 2004-08-05 klockan 09.50 skrev Davyd Madeley:
> > > 	http://davyd.angrygoats.net/battstat.patch
> 
> > I18n aspects of this patch are not so well done. Do you know how to
> > use ngettext (ie. plurals) in especially get_remaining function?
> 
> Ok, I've resolved this.
> 
> > Also this kind of changes are very ackward from translators' point of
> > view:
> > 
> > - label = gtk_label_new (_("Your battery is now fully recharged."));
> > + label = gtk_label_new (_("<b>Your battery is now fully recharged.</b>"));
> 
> I've also resolved this.
> 
> Please advise if there is anything else that will be an issue to the
> translators. Updated patch available at URL above.

Ok.

	mins_string = g_strdup_printf (ngettext ("%i minute", "%i minutes", mins), mins);
	hours_string = g_strdup_printf (ngettext ("%i hour", "%i hours", hours), hours);
[...]
	return_string = g_strdup_printf("%s %s",
			hours_string, mins_string);

I don't think this will work well for RTL situations. I can imagine an
RTL translator wanting to swap the two %s so that he or she can produce
an end result that is something like "setunim 43 ruoh 1".
This means that the "%s %s" string needs to be marked for translation
(and an appropriate explaining comment be added):

	/* Translation Note: The %s:s are the "%i hour" and "%i minute" messages translated elsewhere respectively.
                             Swap the order with "%2$s %1$s" if needed. */
	return_string = g_strdup_printf(_("%s %s"),
			hours_string, mins_string);


This message needs a comment that explains what the %s will be replaced
with. I've added an example comment (can probably be improved):

	/* Translation Note: The %s will be replaced with the "1 hour 34 minutes" or "Unknown time" messages translated elsewhere. */
	new_label2 = g_strdup_printf (_("%s (%d%%) remaining. To avoid losing work please power off, suspend or plug your laptop in."),
			new_string, batt_life);

Add a similar comment here:

	new_label = g_strdup_printf (_("System is running on battery power\n%s (%d%%) remaining"),
		new_string, batt_life);

And here:

	new_label = g_strdup_printf (_("System is running on AC power\n%s (%d%%) till charged"),
		new_string, batt_life);

And here:

	new_string = g_strdup_printf (_("System is running on battery power. %s (%d%%) remaining."),
		rem_time, batt_life);

And here:

	new_string = g_strdup_printf (_("System is running on AC power. %s (%d%%) till charged."),
		rem_time, batt_life);

And here:

	new_label = g_strdup_printf (_("System is running on battery power. %s (%d%%) remaining."),
		time_string, batt_life);

And here:

	new_label = g_strdup_printf (_("System is running on AC power. %s (%d%%) till charged."),
		time_string, batt_life);

And here:

	new_label = g_strdup_printf (_("System is running on battery power\n%s (%d%%) remaining."),
		time_string, batt_life);

And here:

	new_label = g_strdup_printf (_("System is running on AC power\n%s (%d%%) till charged."),
		time_string, batt_life);

In short, avoid "string surgery" whenever possible, i.e. placing
translatable strings inside other translateable strings. If there's no
way around it like in this case, please always at least add a comment
telling what string(s) will be inserted in the message. Always assume
the translator only sees just the strings and not the code behind them,
and thus doesn't see how they relate.


Christian



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]