! 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 !
clock panel plugin shows no tooltip if translated date format is already UTF8
Status:
RESOLVED: FIXED
Severity:
enhancement
Product:
Xfce4-panel

Comments

Description Ambrose LI Cheuk-Wing 2004-09-26 06:19:08 CEST
In HEAD, the clock panel plugin calls strftime on a localized format string to
get the localized date, and then calls

utf8date = g_locale_to_utf8 (date_s, -1, NULL, NULL, NULL);

If the localized format string is already in UTF8 (such as the case in
traditional Chinese, and, if done properly, also would be the case in other CJK
languages), the g_locale_to_utf8 will fail, resulting in no tooltip being displayed.
Comment 1 Jasper Huijsmans editbugs 2004-09-26 08:24:50 CEST
Should be fixed now (after usual anoncvs delay). Please verify.
Comment 2 Ambrose LI Cheuk-Wing 2004-09-27 01:10:16 CEST
This is partially working. If HEAD were not in a string freeze I'd suggest
restoring the old XFCE 4.0 code.

The tool tip now shows up, but truncated where the day of the week is supposed
to appear. I think what happens is that while the localized format string itself
is in UTF8, %a returned by strftime is in the local charset (usually, but not
always, not UTF8), so when GTK gets to the result of the %a, it gets confused
and stops.

(I thought about entering the localized format string in the local charset in
the po file, but we can never be sure what the local charset is, so this idea
doesn't work either.)

(We could make the clock panel look for %a and other strings that may return a
non-UTF8 result, and handle that itself, but I think if we do something this
complicated we may as well just restore the old code.)

:-(
Comment 3 Jasper Huijsmans editbugs 2004-09-27 06:42:30 CEST
Wow, you mean that strftime returns mixed utf8/locale charset strings? That
sounds so broken. I'm not sure if i can check for that. I'll try to come up with
something.
Comment 4 Ambrose LI Cheuk-Wing 2004-09-27 14:54:54 CEST
As for strftime's apparent brokenness, I think strftime just copies text
verbatim from the format string (since it can't know what charset it is in), but
generates strings in locale charset when it sees %a or other such things. If the
po file and the locale charset don't match, we end up with a mix of charsets :-/
Comment 5 Jasper Huijsmans editbugs 2004-09-27 17:38:21 CEST
Aha, that may be it. So, if the problematic languages (well, you know what I
mean) would use a format string without additional characters it would work?

That would be a solution that can easily be part of 4.2. I'm rather reluctant to
get rid of the strftime, since it should normally give us free translations and
allow proper date formats for every locale.

Another solution, I guess is to use the utf-8 version of your locale, but I
assume that will not be so easy to do.
Comment 6 Ambrose LI Cheuk-Wing 2004-09-28 05:28:30 CEST
I have verified that, indeed, if the format string does not contain any UTF8,
the whole format string will appear in the tooltip. (This basically means the
date has to be displayed as an ISO-format date, since the ISO date format is
basically the CJK format with the kanji removed.)

This would be a slightly sub-optimal solution; but given the circumstances I
guess this would constitute a reasonable workaround.

Another workaround (also sub-optimal but in a different way) would be to not
mention the day of the week in the translations; this way the date format can be
very natural but there cannot be any day of the week in the tooltip.

As for free translations for the date format, I will have some reservation:
since the natural word order in date formats are often different in different
languages, I would say the date format would still come out wrong-ish in many
locales (that do not have proper translations). For example, if the CJK
translators have not translated the date format string, the tooltip would use
the default English format; the result would still be comprehensible, but the
word order would be very strange and unnatural and it would seem like it's
missing words.
Comment 7 Jasper Huijsmans editbugs 2004-09-28 05:58:58 CEST
(In reply to comment #6)
> I have verified that, indeed, if the format string does not contain any UTF8,
> the whole format string will appear in the tooltip. (This basically means the
> date has to be displayed as an ISO-format date, since the ISO date format is
> basically the CJK format with the kanji removed.)
> 

Ok, that at least determines the problem, thanks.

> This would be a slightly sub-optimal solution; but given the circumstances I
> guess this would constitute a reasonable workaround.
> 
> Another workaround (also sub-optimal but in a different way) would be to not
> mention the day of the week in the translations; this way the date format can be
> very natural but there cannot be any day of the week in the tooltip.
> 

Ok, I'll leave that up to the translator. I agree both are suboptimal, but
probably the best we can do for now.

Could you provide a patch, or an updated po-file?

I'll leave the bug open, so we can try to think of a better solution for the future.

> As for free translations for the date format, I will have some reservation:
> since the natural word order in date formats are often different in different
> languages, I would say the date format would still come out wrong-ish in many
> locales (that do not have proper translations). For example, if the CJK
> translators have not translated the date format string, the tooltip would use
> the default English format; the result would still be comprehensible, but the
> word order would be very strange and unnatural and it would seem like it's
> missing words.

Yeah, that was rather short-sighted of me, especially considering the fact that
I am a translator myself and have indeed encountered that problem.

Comment 8 Jasper Huijsmans editbugs 2004-11-14 10:09:03 CET
Ok, this is at least provisionally fixed for 4.2. Setting severity to
enhancement and will have to look at this again for 4.3.

I'm wondering if setting the default to %x would be an acceptable solution.
Comment 9 Harold Aling 2007-02-14 22:41:30 CET
I assume this is fixed with the current version (4.4) since the latest reply is dated 2004-11-14...

Bug #332

Reported by:
Ambrose LI Cheuk-Wing
Reported on: 2004-09-26
Last modified on: 2010-11-20

People

Assignee:
Nick Schermer
CC List:
0 users

Version

Attachments

Additional information