From 4053ab0a968ca580edc670536b9d85431e7870fc Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 6 Dec 2017 12:01:21 +0100 Subject: Enable locale support at runtime. --- configure.ac | 16 +++++++++++++++- src/indicator-notifications.c | 4 ++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index b989545..75a55fe 100644 --- a/configure.ac +++ b/configure.ac @@ -16,10 +16,24 @@ AC_PROG_LIBTOOL # Setup gettext with intltool +AC_DEFUN([AC_DEFINE_PATH], [ + test "x$prefix" = xNONE && prefix="$ac_default_prefix" + test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + ac_define_path=`eval echo [$]$2` + ac_define_path=`eval echo [$]ac_define_path` + $1="$ac_define_path" + AC_SUBST($1) + ifelse($3, , + AC_DEFINE_UNQUOTED($1, "$ac_define_path"), + AC_DEFINE_UNQUOTED($1, "$ac_define_path", $3)) +]) + IT_PROG_INTLTOOL GETTEXT_PACKAGE=ayatana-indicator-notifications -AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext package]) AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Gettext package]) +AC_DEFINE_PATH([LOCALEDIR], "${datadir}/locale", [locale directory]) +AM_GLIB_GNU_GETTEXT # Helpers for GSettings diff --git a/src/indicator-notifications.c b/src/indicator-notifications.c index b9a123d..0655445 100644 --- a/src/indicator-notifications.c +++ b/src/indicator-notifications.c @@ -141,6 +141,10 @@ indicator_notifications_class_init(IndicatorNotificationsClass *klass) { GObjectClass *object_class = G_OBJECT_CLASS (klass); + setlocale(LC_ALL, ""); + bindtextdomain( GETTEXT_PACKAGE, LOCALEDIR ); + textdomain( GETTEXT_PACKAGE ); + g_type_class_add_private(klass, sizeof(IndicatorNotificationsPrivate)); object_class->dispose = indicator_notifications_dispose; -- cgit v1.2.3