[gnome-nibbles] Use Gettext.



commit 04e5cdb9c7cb0dca6fe42115b9856de7dccc36d8
Author: Arnaud Bonatti <arnaud bonatti gmail com>
Date:   Fri Nov 6 18:38:41 2015 +0100

    Use Gettext.

 src/Makefile.am        |    1 +
 src/config.vapi        |    1 +
 src/gnome-nibbles.vala |    5 +++++
 3 files changed, 7 insertions(+), 0 deletions(-)
---
diff --git a/src/Makefile.am b/src/Makefile.am
index aefd4a4..19cdef5 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -19,6 +19,7 @@ gnome_nibbles_CPPFLAGS = \
        -DPKGDATADIR=\"$(datadir)/gnome-nibbles\" \
        -DGETTEXT_PACKAGE=\"$(GETTEXT_PACKAGE)\" \
        -DSOUND_DIRECTORY=\"$(datadir)/gnome-nibbles/sounds\" \
+       -DLOCALEDIR=\"$(datadir)/locale\" \
        $(GNOME_NIBBLES_CFLAGS)
 
 gnome_nibbles_VALAFLAGS = \
diff --git a/src/config.vapi b/src/config.vapi
index 9aa9a8f..c3dfa40 100644
--- a/src/config.vapi
+++ b/src/config.vapi
@@ -2,3 +2,4 @@ public const string PKGDATADIR;
 public const string GETTEXT_PACKAGE;
 public const string VERSION;
 public const string SOUND_DIRECTORY;
+public const string LOCALEDIR;
diff --git a/src/gnome-nibbles.vala b/src/gnome-nibbles.vala
index 16ff96e..f33a604 100644
--- a/src/gnome-nibbles.vala
+++ b/src/gnome-nibbles.vala
@@ -780,6 +780,11 @@ public class Nibbles : Gtk.Application
 
     public static int main (string[] args)
     {
+        Intl.setlocale (LocaleCategory.ALL, "");
+        Intl.bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
+        Intl.bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+        Intl.textdomain (GETTEXT_PACKAGE);
+
         var context = new OptionContext ("");
 
         context.add_group (Gtk.get_option_group (false));


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