[geany/geany] 50feb0: Improve support of compiling without gettext

Matthew Brush git-noreply at xxxxx
Wed May 21 22:38:16 UTC 2014


Branch:      refs/heads/master
Author:      Matthew Brush <matt at geany.org>
Committer:   Matthew Brush <matt at geany.org>
Date:        Wed, 21 May 2014 22:38:16 UTC
Commit:      50feb0e05c87ff973ca678e255842e5fe43badc3
             https://github.com/geany/geany/commit/50feb0e05c87ff973ca678e255842e5fe43badc3

Log Message:
-----------
Improve support of compiling without gettext

* If GETTEXT_PACKAGE is not defined (ex. by build system/user) then
  define it to NULL. Most GLib gettext-functions allow passing NULL
  to use the domain set with textdomain().
* Improve the ngettext() wrapper macro.
* Improve/fix bind_textdomain_codeset() wrapper macro.
* Fix argument in bindtextdomain()
* Cast bind*textdomain*() results with (void) to get rid of compiler
  warnings when building without GETTEXT_PACKAGE defined.


Modified Paths:
--------------
    src/main.c
    src/support.h

Modified: src/main.c
4 lines changed, 2 insertions(+), 2 deletions(-)
===================================================================
@@ -489,8 +489,8 @@ void main_locale_init(const gchar *locale_dir, const gchar *package)
 	l_locale_dir = g_strdup(locale_dir);
 #endif
 
-	bindtextdomain(package, l_locale_dir);
-	bind_textdomain_codeset(package, "UTF-8");
+	(void) bindtextdomain(package, l_locale_dir);
+	(void) bind_textdomain_codeset(package, "UTF-8");
 	g_free(l_locale_dir);
 }
 


Modified: src/support.h
9 lines changed, 5 insertions(+), 4 deletions(-)
===================================================================
@@ -35,13 +35,14 @@ G_BEGIN_DECLS
 #ifdef GETTEXT_PACKAGE
 # include <glib/gi18n-lib.h>
 #else
+# define GETTEXT_PACKAGE NULL
 # define textdomain(String) (String)
-# define bind_textdomain_codeset(String) (String)
-# define bindtextdomain(Domain,Charset) (Domain)
-# define ngettext(String) (String)
+# define bind_textdomain_codeset(Domain,Codeset) (Codeset)
+# define bindtextdomain(Domain,Dir) (Dir)
+# define ngettext(String,PluralString,Number) (((Number) == 1) ? (String) : (PluralString))
 # define _(String) String
-# define Q_(String) g_strip_context((String), (String))
 # define N_(String) String
+# define C_(Context,String) (String)
 #endif
 
 G_END_DECLS



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list