summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGaël Bonithon <gael@xfce.org>2022-03-12 09:52:23 +0100
committerGaël Bonithon <gael@xfce.org>2022-03-15 11:06:03 +0000
commit60b1b577ee1afe12990c6d5ab751dfdc72ac9adf (patch)
tree8fcb4de999028c6d55e4bd50859ef824c9834146
parent98c3e867d10ba378b0915a4349db7cdf6ab66414 (diff)
downloadlibxfce4ui-60b1b577ee1afe12990c6d5ab751dfdc72ac9adf.tar.gz
i18n: Do not use textdomain() in libs
This makes the library the default translation domain and thus breaks the translation system for applications that use the library. See also: https://developer-old.gnome.org/glib/stable/glib-I18N.html https://gitlab.xfce.org/xfce/libxfce4util/-/blob/0ef5af7114fd357d7cdb8b20c66f69791858a21c/libxfce4util/libxfce4util-private.c#L41
-rw-r--r--configure.ac.in2
-rw-r--r--libxfce4kbd-private/xfce-shortcut-dialog.c5
-rw-r--r--libxfce4kbd-private/xfce-shortcuts-editor-dialog.c5
-rw-r--r--libxfce4kbd-private/xfce-shortcuts-editor.c5
-rw-r--r--libxfce4kbd-private/xfce-shortcuts-xfwm4.c5
-rw-r--r--libxfce4kbd-private/xfce-shortcuts.c5
6 files changed, 21 insertions, 6 deletions
diff --git a/configure.ac.in b/configure.ac.in
index 5fb2a14..eb1eee8 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -108,7 +108,7 @@ dnl ***************************************
AC_CHECK_HEADERS([crt_externs.h errno.h fcntl.h limits.h locale.h math.h \
memory.h signal.h stdarg.h stdlib.h string.h unistd.h])
AC_CHECK_DECLS([environ])
-AC_CHECK_FUNCS([_NSGetEnviron])
+AC_CHECK_FUNCS([_NSGetEnviron bind_textdomain_codeset])
dnl ******************************
dnl *** Check for i18n support ***
diff --git a/libxfce4kbd-private/xfce-shortcut-dialog.c b/libxfce4kbd-private/xfce-shortcut-dialog.c
index bef7f6e..7698d62 100644
--- a/libxfce4kbd-private/xfce-shortcut-dialog.c
+++ b/libxfce4kbd-private/xfce-shortcut-dialog.c
@@ -129,7 +129,10 @@ xfce_shortcut_dialog_class_init (XfceShortcutDialogClass *klass)
GObjectClass *gobject_class;
/* Make sure to use the translations from libxfce4ui */
- xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = xfce_shortcut_dialog_finalize;
diff --git a/libxfce4kbd-private/xfce-shortcuts-editor-dialog.c b/libxfce4kbd-private/xfce-shortcuts-editor-dialog.c
index b13e213..c3139fc 100644
--- a/libxfce4kbd-private/xfce-shortcuts-editor-dialog.c
+++ b/libxfce4kbd-private/xfce-shortcuts-editor-dialog.c
@@ -57,7 +57,10 @@ static void
xfce_shortcuts_editor_dialog_class_init (XfceShortcutsEditorDialogClass *klass)
{
/* Make sure to use the translations from libxfce4ui */
- xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
}
diff --git a/libxfce4kbd-private/xfce-shortcuts-editor.c b/libxfce4kbd-private/xfce-shortcuts-editor.c
index 65412f6..ef418da 100644
--- a/libxfce4kbd-private/xfce-shortcuts-editor.c
+++ b/libxfce4kbd-private/xfce-shortcuts-editor.c
@@ -113,7 +113,10 @@ xfce_shortcuts_editor_class_init (XfceShortcutsEditorClass *klass)
GObjectClass *gobject_class;
/* Make sure to use the translations from libxfce4ui */
- xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
gobject_class = G_OBJECT_CLASS (klass);
gobject_class->finalize = xfce_shortcuts_editor_finalize;
diff --git a/libxfce4kbd-private/xfce-shortcuts-xfwm4.c b/libxfce4kbd-private/xfce-shortcuts-xfwm4.c
index 9caf627..9371ec0 100644
--- a/libxfce4kbd-private/xfce-shortcuts-xfwm4.c
+++ b/libxfce4kbd-private/xfce-shortcuts-xfwm4.c
@@ -120,7 +120,10 @@ xfce_shortcuts_xfwm4_get_feature_name (const gchar *feature)
guint i;
/* Make sure to use the translations from libxfce4ui */
- xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
/* We need to get the human readable string of the action name */
for (i = 0; xfwm4_shortcut_values[i].name != NULL; ++i)
diff --git a/libxfce4kbd-private/xfce-shortcuts.c b/libxfce4kbd-private/xfce-shortcuts.c
index c81fa5e..79adac8 100644
--- a/libxfce4kbd-private/xfce-shortcuts.c
+++ b/libxfce4kbd-private/xfce-shortcuts.c
@@ -93,7 +93,10 @@ xfce_shortcut_conflict_dialog (GtkWindow *parent,
handled = FALSE;
/* Make sure to use the translations from libxfce4ui */
- xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+#ifdef HAVE_BIND_TEXTDOMAIN_CODESET
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
if (g_utf8_collate (owner, other) == 0 && ignore_same_provider)
return GTK_RESPONSE_ACCEPT;