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,
I think this problem cannot be fixed due to the basic architecture of SCIM.
This problem is inevitable as long as processes load SCIM library.
I'll left this problem as "Wont Fix" for now.
Please revert it if somebody has a good idea.
scim has moved development to github. Seeing that this ticket is unverified I ask you to kindly open a new ticket at https://github.com/scim-im/scim/issues/ if you are still affected by this bug. Thank you.