Thanks Behdad for the quick response. -Gaurav
On 9/30/05, Behdad Esfahbod <[EMAIL PROTECTED]> wrote: > > On Fri, 30 Sep 2005, Gaurav Jain wrote: > > > Hi, > > > > I'm trying to print a date onto a GtkLabel in "ar_SA" (arabic) locale. > For > > this, I'm using the API g_date_strftime(), in which the format being > passed > > is "%c" (to use the current locale's prefered format). > > > > The problem is that the output generated is a corrupt value, such as > > "[??????? %.1d ????? 2005 %.1H:00:00] (the ? stands for an arabic > character, > > which is probably fine, but the actual corruption is due to the unwanted > > "%.1d" and "%.1H" in the output). What I really want is the Arabic-Indic > > representation of the date, in which all the numerals are in the > > arabic-indic digits, but this is obviously not producing that. > > > > Could any one point out what I'm doing wrong here (or how to achive my > > goal)? > > 1. That's not quite supported yet, we are working on supporting > in it for Persian, which affects other languages too. > > 2. Said support will only be available on Glibc. (until Project > Giulia produces some output...) > > 3. Even then, the ar_SA locale should define a local digit set > and this is not currently the case. > > Summary: Not possible at this time. But hey, check first with > the Arab community. I'm not quite sure that using those digits > is actually preferred at all. > > behdad > > > > > > > > > > Thanks, > > Gaurav > > > > ---sample program that I'm using follows ------ > > #include <stdio.h> > > #include <stdlib.h> > > #include <gtk/gtk.h> > > #include <gdk/gdk.h> > > #include <locale.h> > > > > int main(int argc, char *argv[]) > > { > > GtkWidget *window; > > GtkWidget *vbox, *hbox; > > GtkWidget *label; > > > > /* set the default locale - ar_SA for this particular test */ > > setlocale(LC_ALL, ""); > > > > /* generate the date string */ > > char buffer[400] = ""; > > char format[] = "%c"; > > > > char *utf8_format = g_locale_to_utf8(format, -1, NULL, NULL, NULL); > > GDate dateRec; > > dateRec.day = 30; > > dateRec.month = 9; > > dateRec.year = 2005; > > > > if (g_date_strftime(buffer, sizeof(buffer), utf8_format, &dateRec) == 0) > > buffer[0] = '\0'; > > printf("buffer is [%s]\n", buffer); > > > > gtk_init (&argc, &argv); > > > > /* create a new window */ > > window = gtk_window_new (GTK_WINDOW_TOPLEVEL); > > gtk_widget_set_size_request (GTK_WIDGET (window), 200, 100); > > gtk_window_set_title (GTK_WINDOW (window), "Date"); > > g_signal_connect (G_OBJECT (window), "destroy", > > G_CALLBACK (gtk_main_quit), NULL); > > g_signal_connect_swapped (G_OBJECT (window), "delete_event", > > G_CALLBACK (gtk_widget_destroy), > > G_OBJECT (window)); > > > > vbox = gtk_vbox_new (FALSE, 0); > > gtk_container_add (GTK_CONTAINER (window), vbox); > > gtk_widget_show (vbox); > > > > /* create new label with the date buffer */ > > label = gtk_label_new(buffer); > > > > gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0); > > gtk_widget_show (label); > > > > hbox = gtk_hbox_new (FALSE, 0); > > gtk_container_add (GTK_CONTAINER (vbox), hbox); > > gtk_widget_show (hbox); > > > > gtk_widget_show (window); > > > > gtk_main(); > > > > return 0; > > } > > > > --behdad > http://behdad.org/ > _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list