From: SourceForge.net <no...@so...> - 2008-05-16 17:29:32
|
Bugs item #1965543, was opened at 2008-05-16 19:29 Message generated for change (Tracker Item Submitted) made by Item Submitter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=650539&aid=1965543&group_id=108454 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Core: libscim Group: CVS Status: Open Resolution: None Priority: 5 Private: No Submitted By: Benjamin Monate (ben_99_9) Assigned to: James Su (suzhe) Summary: Strange call to setlocale(LC_MESSAGES,"") Initial Comment: Dear dev team, In file scim_private.cpp, the constructor fo TextdomainInitializer contains : ========== char *locale = setlocale (LC_MESSAGES, 0); if (!locale || strcmp (locale, "C") == 0 || strcmp (locale, "POSIX") == 0) setlocale (LC_MESSAGES, ""); ========== The last call to setlocale changes the current LC_MESSAGES value. The original locale value is never reset. Here is an example of why this has undesired side effects for Gtk applications using GTK_IM_MODULE=scim ==main.c= #include <gtk/gtk.h> #include <locale.h> int main (int argc, char *argv[]) { GtkWidget *window; GtkWidget *label; gtk_disable_setlocale (); gtk_init (&argc, &argv); window = gtk_window_new (GTK_WINDOW_TOPLEVEL); label = gtk_text_view_new(); printf ("BEFORE PACKING:%s\n",setlocale(LC_ALL,NULL)); gtk_container_add (GTK_CONTAINER (window), label); gtk_widget_show_all (window); printf ("AFTER PACKING:%s\n",setlocale(LC_ALL,NULL)); gtk_main (); return 0;} ======= Compile with : gcc -g `pkg-config --libs --cflags gtk+-2.0` main.c Running: GTK_IM_MODULE=scim ./a.out outputs === BEFORE PACKING:C AFTER PACKING:LC_CTYPE=C;LC_NUMERIC=C;LC_TIME=C;LC_COLLATE=C;LC_MONETARY=C;LC_MESSAGES=fr_FR.UTF-8;LC_PAPER=C;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=C;LC_IDENTIFICATION=C === whereas running GTK_IM_MODULE= ./a.out outputs === BEFORE PACKING:C AFTER PACKING:C ==== Note the value for LC_MESSAGES (it is reset to the value that was defined in the calling shell) The later is the valid behavior. Otherwise Gtk stock elements will be translated despite the call to gtk_disable_setlocale. Thanks for your attention, ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=650539&aid=1965543&group_id=108454 |