[Evolution-hackers] dgettext abuse?


recently I defined my own private locale for English messages and ISO
date format. Other applications seem to work fine, but Evolution does
not. As an example I chose the "Birthday" field in the Contact Editor.
So I had a look at the source and was impressed by the creativity of
some developer.


/* This sets the text in the date entry according to the current settings. */
static void
e_date_edit_update_date_entry		(EDateEdit	*dedit)
	EDateEditPrivate *priv;
	char buffer[40];
	struct tm tmp_tm = { 0 };

	priv = dedit->priv;

	if (priv->date_set_to_none || !priv->date_is_valid) {
		gtk_entry_set_text (GTK_ENTRY (priv->date_entry), _("None"));
	} else {
		tmp_tm.tm_year = priv->year;
		tmp_tm.tm_mon = priv->month;
		tmp_tm.tm_mday = priv->day;
		tmp_tm.tm_isdst = -1;

		/* This is a strftime() format for a short date. %m = month,
		   %d = day of month, %Y = year (all digits). */
		e_utf8_strftime (buffer, sizeof (buffer), _("%m/%d/%Y"), &tmp_tm);
		gtk_entry_set_text (GTK_ENTRY (priv->date_entry), buffer);

	add_relation (dedit, priv->date_entry);
	add_relation (dedit, priv->date_button);

Obviously dgettext (via the macro _(string) ) is used to "translate" a
date format string. This construct is used at very many other places in
the source code, too. This is not the right way to do it since dgettext
depends on LC_MESSAGES and this should only affect texts, not the date

The date format should be based on the d_fmt property of the current
locale. But I could not find any reference to nl_langinfo in the whole
source tree (2.2.3). Is there any reason behind that or is it plain
ignorance? If it's the latter I'd volunteer to work out some patches.


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