[glib/new-gsettings] Skip localization tests if translations don't work
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/new-gsettings] Skip localization tests if translations don't work
- Date: Thu, 15 Apr 2010 15:21:02 +0000 (UTC)
commit e699d56dbefe19ee774171b65307461915488d44
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Apr 15 11:18:25 2010 -0400
Skip localization tests if translations don't work
gio/tests/gsettings.c | 23 ++++++++++++++++++++++-
1 files changed, 22 insertions(+), 1 deletions(-)
---
diff --git a/gio/tests/gsettings.c b/gio/tests/gsettings.c
index 4827880..6c8871e 100644
--- a/gio/tests/gsettings.c
+++ b/gio/tests/gsettings.c
@@ -431,6 +431,22 @@ test_atomic (void)
g_assert_cmpstr (str, ==, "atomic bye-bye");
}
+static gboolean
+glib_translations_work (void)
+{
+ gchar *locale;
+ gchar *orig = "Unnamed";
+ gchar *str;
+
+ locale = g_strdup (setlocale (LC_MESSAGES, NULL));
+ setlocale (LC_MESSAGES, "de_DE");
+ str = dgettext ("glib20", orig);
+ setlocale (LC_MESSAGES, locale);
+ g_free (locale);
+
+ return str != orig;
+}
+
static void
test_l10n (void)
{
@@ -438,7 +454,12 @@ test_l10n (void)
gchar *str;
gchar *locale;
- bindtextdomain ("glib20", "/usr/share");
+ if (!glib_translations_work ())
+ {
+ g_test_message ("Skipping localization tests because translations don't work");
+ return;
+ }
+
bind_textdomain_codeset ("glib20", "UTF-8");
locale = g_strdup (setlocale (LC_MESSAGES, NULL));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]