After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 317171 - calendar should use localized digits
calendar should use localized digits
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: Other
unspecified
Other All
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks: Persian
 
 
Reported: 2005-09-25 15:56 UTC by Meelad Zakaria
Modified: 2006-01-26 20:40 UTC
See Also:
GNOME target: ---
GNOME version: 2.11/2.12


Attachments
localized digits in gtkcalendar (1.45 KB, patch)
2005-10-01 16:54 UTC, Hamed Malek
none Details | Review
Committed patch (2.26 KB, patch)
2006-01-25 16:46 UTC, Behdad Esfahbod
committed Details | Review
Use "English" instead of "Latin" in translator comments. (2.26 KB, patch)
2006-01-25 17:10 UTC, Behdad Esfahbod
committed Details | Review
fixup patch (3.07 KB, patch)
2006-01-26 02:03 UTC, Behdad Esfahbod
committed Details | Review

Description Meelad Zakaria 2005-09-25 15:56:08 UTC
Please describe the problem:
when running a Persian session, year and day numbers in calendar are shown in
Latin figures, while they should be displayed in Persian figures.

Steps to reproduce:
1. run a Persian gnome-panel
2. click on the clock applet to view the calendar
3. here you are!


Actual results:


Expected results:
numbers should be shown in farsi script

Does this happen every time?
yes

Other information:
Comment 1 Vincent Untz 2005-09-25 16:11:10 UTC
This is a pure GtkCalendar. Moving to GTK+.
Comment 2 Hamed Malek 2005-10-01 16:53:46 UTC
Attached a trivial patch that make two integer conversions (week and day)
translatable. This lets traslators replace it with %Id in po files and get
localized numerals.
Comment 3 Hamed Malek 2005-10-01 16:54:59 UTC
Created attachment 52917 [details] [review]
localized digits in gtkcalendar
Comment 4 Behdad Esfahbod 2006-01-25 16:46:00 UTC
Created attachment 58105 [details] [review]
Committed patch

Hamed, you should not use _("%Id") anytime, anywhere.  See the attached patch for how to use translation contexts.  See docs for Q_ here:

  http://developer.gnome.org/doc/API/2.0/glib/glib-I18N.html
Comment 5 Behdad Esfahbod 2006-01-25 17:10:40 UTC
Created attachment 58109 [details] [review]
Use "English" instead of "Latin" in translator comments.

Using "digits used in English" is more clear and recommended.
Comment 6 Morten Welinder 2006-01-26 00:55:04 UTC
That is not going to work well unless you increase the size of buffer.
Comment 7 Morten Welinder 2006-01-26 01:09:43 UTC
and it looks like you need to have a word with the %d%d in gtk_calendar_size_request.  That logic is questionable on several levels.
Comment 8 Behdad Esfahbod 2006-01-26 01:22:55 UTC
Thanks Morten.  Fixing them.  Any reason that the buffer in calendar_paint_day is 255 bytes?!  I'm setting both buffer's to 9 bytes.  that's the makimum length that two Unicode characters can take.
Comment 9 Morten Welinder 2006-01-26 01:28:11 UTC
No particular reason that I can see, but I get 13: 2*6 + 1.  Make it
somewhat larger just in case some language needs something you have
not thought of; special characters in front or in back.
Comment 10 Behdad Esfahbod 2006-01-26 01:34:20 UTC
Ok.  FYI: Unicode characters are limited to 4 bytes in UTF-8.
Comment 11 Behdad Esfahbod 2006-01-26 02:03:51 UTC
Created attachment 58134 [details] [review]
fixup patch

Fixup patch.  Can use a review.  It fixes a bug in the extent calculation too.

Thinking again, I'm not quite convinced that we need two separate translation strings for week digits and day digits.  But it doesn't really hurt...
Comment 12 Matthias Clasen 2006-01-26 19:04:05 UTC
I think every Q_-translated string should have a translator comment.
Go ahead and commit with that addition.
Comment 13 Behdad Esfahbod 2006-01-26 20:40:20 UTC
Thanks Morten and Matthias.  Should be fixed now.

2006-01-25  Behdad Esfahbod  <behdad@gnome.org>

        * gtk/gtkcalendar.c (gtk_calendar_size_request): Use translated format
        strings for L10n in size calculation too.

        * gtk/gtkcalendar.c (calendar_paint_week_numbers): Expand buffer to
        accomodate localized digits.