nikawhite pushed a commit to branch master.

http://git.enlightenment.org/tools/enventor.git/commit/?id=360170fd7400b973d25c513bc5a0c07342e94c3b

commit 360170fd7400b973d25c513bc5a0c07342e94c3b
Author: Mykyta Biliavskyi <m.biliavs...@samsung.com>
Date:   Thu Dec 10 17:30:00 2015 +0900

    Localization: fix localization support.
    
    Correct initalizing textdomain.
    Use LOCALE_DIR environment variable.
    Support localization in setting.c and text_setting.c files.
---
 configure.ac           | 8 ++++++++
 src/bin/Makefile.am    | 5 ++++-
 src/bin/main.c         | 6 ++++++
 src/bin/setting.c      | 3 +++
 src/bin/text_setting.c | 3 +++
 5 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/configure.ac b/configure.ac
index b0e7cc5..7ca0ed9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -40,6 +40,14 @@ AM_PROG_AS
 AM_GNU_GETTEXT_VERSION(0.18.1)
 AM_GNU_GETTEXT([external])
 
+#===============================================================================
+if test "x${prefix}" = "xNONE"; then
+   LOCALE_DIR="${ac_default_prefix}/share/locale"
+else
+   LOCALE_DIR="${prefix}/share/locale"
+fi
+AC_SUBST(LOCALE_DIR)
+#===============================================================================
 
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
 ##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##--##
diff --git a/src/bin/Makefile.am b/src/bin/Makefile.am
index 2a27e4f..9f520fd 100644
--- a/src/bin/Makefile.am
+++ b/src/bin/Makefile.am
@@ -1,5 +1,7 @@
 MAINTAINERCLEANFILES = Makefile.in
 
+LOCALE_DIR = @LOCALE_DIR@
+
 bin_PROGRAMS = enventor
 
 AM_CPPFLAGS = -DPACKAGE_DATA_DIR=\"$(pkgdatadir)\" \
@@ -35,6 +37,7 @@ enventor_LDFLAGS = $(LTLIBINTL)
 
 enventor_CFLAGS = \
    -I$(top_builddir)/src/lib \
-       @ENVENTOR_CFLAGS@
+       @ENVENTOR_CFLAGS@ \
+       -DLOCALE_DIR=\"@LOCALE_DIR@\"
 
 EXTRA_DIST =
diff --git a/src/bin/main.c b/src/bin/main.c
index be0ed0e..92ecfe8 100644
--- a/src/bin/main.c
+++ b/src/bin/main.c
@@ -875,6 +875,12 @@ keygrabber_init(app_data *ad)
 static Eina_Bool
 init(app_data *ad, int argc, char **argv)
 {
+#ifdef ENABLE_NLS
+      setlocale(LC_ALL, "");
+      bindtextdomain(PACKAGE, LOCALE_DIR);
+      textdomain(PACKAGE);
+#endif /* set locale */
+
    elm_setup();
 
    enventor_init(argc, argv);
diff --git a/src/bin/setting.c b/src/bin/setting.c
index a299977..3d3c9ca 100644
--- a/src/bin/setting.c
+++ b/src/bin/setting.c
@@ -1,3 +1,6 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include "common.h"
 #include "text_setting.h"
 
diff --git a/src/bin/text_setting.c b/src/bin/text_setting.c
index 9292b13..071eef8 100644
--- a/src/bin/text_setting.c
+++ b/src/bin/text_setting.c
@@ -1,3 +1,6 @@
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
 #include "common.h"
 #include "text_setting.h"
 

-- 


Reply via email to