diff -uprk.orig imlib-1.9.14.orig/utils/imlib_config.c imlib-1.9.14/utils/imlib_config.c --- imlib-1.9.14.orig/utils/imlib_config.c 2001-07-17 20:16:03 +0400 +++ imlib-1.9.14/utils/imlib_config.c 2004-08-26 14:37:55 +0400 @@ -124,6 +124,27 @@ struct _vis } *vislist; +static char *saved_locale; + +static void save_current_locale( void ) +{ + saved_locale = setlocale( LC_ALL, 0 ); + if ( saved_locale ) + saved_locale = strdup( saved_locale ); + setlocale( LC_ALL, "C" ); +} + +static void restore_current_locale( void ) +{ + if ( saved_locale ) + { + setlocale( LC_ALL, saved_locale ); + free( saved_locale ); + } + else + setlocale( LC_ALL, "" ); +} + GdkImlibImage * make_pal_image() { @@ -425,7 +446,6 @@ load_pal(char *f) int r, g, b, i; char s[1024]; - setlocale(LC_ALL, "C"); ff = fopen(f, "r"); if (ff) { @@ -460,7 +480,6 @@ load_pal(char *f) color.color[i][1] = 0; color.color[i][2] = 0; } - setlocale(LC_ALL, ""); } void @@ -469,15 +488,13 @@ save_pal(char *f) FILE *ff; int i; - setlocale(LC_ALL, "C"); ff = fopen(f, "w"); if (ff) { for (i = 0; i < color.number; i++) - fprintf(ff, "0x%x 0x%x 0x%x\n", color.color[i][0], color.color[i][1], color.color[i][2]); + fprintf(ff, "%#x %#x %#x\n", color.color[i][0], color.color[i][1], color.color[i][2]); fclose(ff); } - setlocale(LC_ALL, ""); } void @@ -756,7 +773,7 @@ load_imrc() h = getenv("HOME"); g_snprintf(s, 2048, "%s/.imrc", h); - setlocale(LC_ALL, "C"); + save_current_locale(); f = fopen(s, "r"); if (!f) { @@ -765,7 +782,7 @@ load_imrc() free(h); } read_imrc(f); - setlocale(LC_ALL, ""); + restore_current_locale(); } void @@ -777,9 +794,9 @@ save_user(GtkWidget * widget, gpointer * h = getenv("HOME"); g_snprintf(s, 2048, "%s/.imrc", h); f = fopen(s, "w"); - setlocale(LC_ALL, "C"); + save_current_locale(); write_imrc(f); - setlocale(LC_ALL, ""); + restore_current_locale(); } void @@ -791,10 +808,9 @@ save_sys(GtkWidget * widget, gpointer * h = gdk_imlib_get_sysconfig(); f = fopen(h, "w"); free(h); - setlocale(LC_ALL, "C"); + save_current_locale(); write_imrc(f); - setlocale(LC_ALL, ""); - + restore_current_locale(); } void @@ -1500,6 +1516,10 @@ int main(int argc, char **argv) { gtk_set_locale(); +#ifdef ENABLE_NLS + bindtextdomain(PACKAGE,GNOMELOCALEDIR); + textdomain(PACKAGE); +#endif gtk_init(&argc, &argv); gdk_imlib_init(); list_vis();