tests: fix glib_translations_work()

If setlocale() to our test locale fails, translations
won't work either.

https://bugzilla.gnome.org/show_bug.cgi?id=654017
This commit is contained in:
Tim-Philipp Müller 2011-07-05 14:30:31 +01:00 committed by Matthias Clasen
parent 5eee90fbbc
commit 7654a848e2

View File

@ -1479,17 +1479,19 @@ test_child_schema (void)
static gboolean static gboolean
glib_translations_work (void) glib_translations_work (void)
{ {
gboolean works;
gchar *locale; gchar *locale;
gchar *orig = "Unnamed"; gchar *orig = "Unnamed";
gchar *str;
locale = g_strdup (setlocale (LC_MESSAGES, NULL)); locale = g_strdup (setlocale (LC_MESSAGES, NULL));
setlocale (LC_MESSAGES, "de"); if (!setlocale (LC_MESSAGES, "de"))
str = dgettext ("glib20", orig); works = FALSE;
else
works = dgettext ("glib20", orig) != orig;
setlocale (LC_MESSAGES, locale); setlocale (LC_MESSAGES, locale);
g_free (locale); g_free (locale);
return str != orig; return works;
} }
#include "../strinfo.c" #include "../strinfo.c"