}
#endif /* HAVE_GNOME */
+static const gchar *localedir;
+
#ifdef ENABLE_BUNDLE
static gboolean locale_files_write(void)
{
*catalog_next++='\0';
cc=g_strdup(catalog);
cc_end=cc+strlen(cc)-strlen(".gmo");
- if (!strcmp(cc_end,".gmo")) { /* errors ignored */
+ if (cc_end>cc && !strcmp(cc_end,".gmo")) {
*cc_end='\0';
- bundle_util_file_write( /* errors ignored */
+ if (!bundle_util_file_write(
udpgate_printf_alloca("%s/%s/LC_MESSAGES/%s.mo",LOCALEDIR,cc,PACKAGE), /* pathname */
catalog, /* basename */
0644, /* pathname_mode */
- FALSE); /* pathname_backup */
+ BUNDLE_UTIL_MKDIRS_MASK|BUNDLE_UTIL_TEMPORARY_MASK)) { /* flags */
+const gchar *tmpdir=g_get_tmp_dir();
+const gchar *username=g_get_user_name();
+gchar *trylocaledir=localedir;
+
+ if (!trylocaledir && tmpdir && username)
+ trylocaledir=g_strdup_printf("%s/.%s-%s/locale",tmpdir,username,PACKAGE);
+ if (trylocaledir && bundle_util_file_write(
+ udpgate_printf_alloca("%s/%s/LC_MESSAGES/%s.mo",trylocaledir,cc,PACKAGE), /* pathname */
+ catalog, /* basename */
+ 0644, /* pathname_mode */
+ BUNDLE_UTIL_MKDIRS_MASK|BUNDLE_UTIL_TEMPORARY_MASK)) /* flags */
+ localedir=trylocaledir;
+ }
+
}
g_free(cc);
}
/* Initialize the i18n stuff */
setlocale(LC_ALL,"");
- bindtextdomain(PACKAGE,LOCALEDIR);
+ if (!localedir)
+ localedir=LOCALEDIR;
+ bindtextdomain(PACKAGE,localedir);
textdomain(PACKAGE);
/* Read it before the command-line parsing to get the default value