[gtksourceview] Remove ENABLE_NLS option



commit da3fd6eea5d10958fb64d645d9b2e1b71572ac6b
Author: Sébastien Wilmet <swilmet gnome org>
Date:   Thu Sep 21 20:09:01 2017 +0200

    Remove ENABLE_NLS option
    
    Always enable gettext support.
    
    I don't think this option was often used, maybe by a USE flag in Gentoo.
    It is anyway not really useful, and the simpler code the better.
    
    Other GNOME modules like gspell don't have the ENABLE_NLS option and
    nobody complained. Since GtkSourceView is similar to gspell, i18n can be
    handled the same way as in gspell.

 config.h.win32.in                  |    3 ---
 configure.ac                       |    3 ---
 gtksourceview/gtksourceview-i18n.c |   13 ++++---------
 gtksourceview/gtksourceview-i18n.h |   35 ++++-------------------------------
 gtksourceview/gtksourceview-init.c |   23 ++++++++---------------
 5 files changed, 16 insertions(+), 61 deletions(-)
---
diff --git a/config.h.win32.in b/config.h.win32.in
index f39180f..8e3c426 100644
--- a/config.h.win32.in
+++ b/config.h.win32.in
@@ -1,8 +1,5 @@
 /* config.h.in.  Generated from configure.ac by autoheader.  */
 
-/* Defined if native language support should be enabled. */
-#define ENABLE_NLS 1
-
 /* Define to the gettext package name. */
 #define GETTEXT_PACKAGE "@GETTEXT_PACKAGE@"
 
diff --git a/configure.ac b/configure.ac
index 81d5dd3..c7bd224 100644
--- a/configure.ac
+++ b/configure.ac
@@ -188,9 +188,6 @@ AS_IF([ test "$glade_catalog" = "yes" ],
 AM_GNU_GETTEXT([external])
 AM_GNU_GETTEXT_VERSION([0.19.4])
 
-AS_IF([test "$USE_NLS" = "yes"],
-      [AC_DEFINE([ENABLE_NLS], [1], [Defined if native language support should be enabled.])])
-
 AC_SUBST([GETTEXT_PACKAGE], [gtksourceview-$GSV_API_VERSION])
 AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE], ["$GETTEXT_PACKAGE"], [Define to the gettext package name.])
 
diff --git a/gtksourceview/gtksourceview-i18n.c b/gtksourceview/gtksourceview-i18n.c
index 705a0ed..acfc9e4 100644
--- a/gtksourceview/gtksourceview-i18n.c
+++ b/gtksourceview/gtksourceview-i18n.c
@@ -1,6 +1,6 @@
 /* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; coding: utf-8 -*- *
+ *
  * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
- * All rights reserved.
  *
  * This file is part of GtkSourceView
  *
@@ -13,7 +13,7 @@
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  * Lesser General Public License for more details.
-
+ *
  * You should have received a copy of the GNU Lesser General Public License
  * along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
@@ -22,11 +22,10 @@
 #include <config.h>
 #endif
 
-#include <string.h>
-
 #include "gtksourceview-i18n.h"
+#include <string.h>
 
-/**
+/*
  * _gtksourceview_dgettext:
  *
  * Try to translate string from given domain. It returns
@@ -36,7 +35,6 @@ gchar *
 _gtksourceview_dgettext (const gchar *domain,
                          const gchar *string)
 {
-#ifdef ENABLE_NLS
        const gchar *translated;
        gchar *tmp;
 
@@ -61,7 +59,4 @@ _gtksourceview_dgettext (const gchar *domain,
 
        tmp = g_locale_to_utf8 (translated, -1, NULL, NULL, NULL);
        return tmp != NULL ? tmp : g_strdup (string);
-#else
-       return g_strdup (string);
-#endif
 }
diff --git a/gtksourceview/gtksourceview-i18n.h b/gtksourceview/gtksourceview-i18n.h
index 64eaa69..4de8bf5 100644
--- a/gtksourceview/gtksourceview-i18n.h
+++ b/gtksourceview/gtksourceview-i18n.h
@@ -3,7 +3,7 @@
  * This file is part of GtkSourceView
  *
  * Copyright (C) 1997, 1998, 1999, 2000 Free Software Foundation
- * Copyright (C) 2016 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2016, 2017 - Sébastien Wilmet <swilmet gnome org>
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -19,9 +19,7 @@
  * along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 
-/* Handles all of the internationalization configuration options.
- * Author: Tom Tromey <tromey creche cygnus com>
- */
+/* Author: Tom Tromey <tromey creche cygnus com> */
 
 #ifndef GTKSOURCEVIEW_18N_H
 #define GTKSOURCEVIEW_18N_H 1
@@ -31,36 +29,11 @@
 #endif
 
 #include <glib.h>
+#include <glib/gi18n-lib.h>
 
 G_BEGIN_DECLS
 
-#ifdef ENABLE_NLS
-#    include <glib/gi18n-lib.h>
-#    undef GD_
-#    define GD_(Domain,String) _gtksourceview_dgettext (Domain, String)
-#else
-/* Stubs that do something close enough. */
-#    undef textdomain
-#    define textdomain(String) (String)
-#    undef gettext
-#    define gettext(String) (String)
-#    undef dgettext
-#    define dgettext(Domain,Message) (Message)
-#    undef dcgettext
-#    define dcgettext(Domain,Message,Type) (Message)
-#    undef bindtextdomain
-#    define bindtextdomain(Domain,Directory) (Domain)
-#    undef bind_textdomain_codeset
-#    define bind_textdomain_codeset(Domain,CodeSet) (Domain)
-#    undef _
-#    define _(String) (String)
-#    undef N_
-#    define N_(String) (String)
-#    undef GD_
-#    define GD_(Domain,String) (g_strdup (String))
-#    undef C_
-#    define C_(Context,String) (String)
-#endif
+#define GD_(Domain,String) _gtksourceview_dgettext (Domain, String)
 
 /* NOTE: it returns duplicated string */
 G_GNUC_INTERNAL
diff --git a/gtksourceview/gtksourceview-init.c b/gtksourceview/gtksourceview-init.c
index cb498db..74d2814 100644
--- a/gtksourceview/gtksourceview-init.c
+++ b/gtksourceview/gtksourceview-init.c
@@ -2,7 +2,7 @@
  *
  * This file is part of GtkSourceView
  *
- * Copyright (C) 2016 - Sébastien Wilmet <swilmet gnome org>
+ * Copyright (C) 2016, 2017 - Sébastien Wilmet <swilmet gnome org>
  *
  * GtkSourceView is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -27,9 +27,7 @@
 #include <config.h>
 #endif
 
-#ifdef ENABLE_NLS
 #include <glib/gi18n-lib.h>
-#endif
 
 #include "gconstructor.h"
 #include "gtksourcelanguagemanager.h"
@@ -42,10 +40,8 @@
 static HMODULE gtksourceview_dll;
 #endif
 
-#ifdef ENABLE_NLS
-
-#  ifdef OS_OSX
-#  include <Cocoa/Cocoa.h>
+#ifdef OS_OSX
+#include <Cocoa/Cocoa.h>
 
 static gchar *
 dirs_os_x_get_bundle_resource_dir (void)
@@ -95,14 +91,14 @@ dirs_os_x_get_locale_dir (void)
 
        return ret;
 }
-#  endif /* OS_OSX */
+#endif /* OS_OSX */
 
 static gchar *
 get_locale_dir (void)
 {
        gchar *locale_dir;
 
-#  if defined (G_OS_WIN32)
+#if defined (G_OS_WIN32)
        gchar *win32_dir;
 
        win32_dir = g_win32_get_package_installation_directory_of_module (gtksourceview_dll);
@@ -110,20 +106,18 @@ get_locale_dir (void)
        locale_dir = g_build_filename (win32_dir, "share", "locale", NULL);
 
        g_free (win32_dir);
-#  elif defined (OS_OSX)
+#elif defined (OS_OSX)
        locale_dir = dirs_os_x_get_locale_dir ();
-#  else
+#else
        locale_dir = g_build_filename (DATADIR, "locale", NULL);
-#  endif
+#endif
 
        return locale_dir;
 }
-#endif /* ENABLE_NLS */
 
 static void
 gtksourceview_init (void)
 {
-#ifdef ENABLE_NLS
        gchar *locale_dir;
 
        locale_dir = get_locale_dir ();
@@ -131,7 +125,6 @@ gtksourceview_init (void)
        g_free (locale_dir);
 
        bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-#endif /* ENABLE_NLS */
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]