[california] Internationalization work



commit f8b7d88354745840a7032fc84bc27540f1d23bad
Author: Jim Nelson <jim yorba org>
Date:   Mon Mar 10 16:59:21 2014 -0700

    Internationalization work
    
    A little extra work needed to be done to get California to use
    the new translations.

 po/POTFILES.in                              |    1 +
 src/Makefile.am                             |    1 +
 src/application/california-application.vala |   11 ++++++++++-
 3 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 920f0ed..15d58d0 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -5,5 +5,6 @@ src/calendar/calendar.vala
 src/host/host-create-update-event.vala
 src/host/host-main-window.vala
 src/host/host-show-event.vala
+[type: gettext/glade]src/rc/app-menu.interface
 [type: gettext/glade]src/rc/create-update-event.ui
 [type: gettext/glade]src/rc/show-event.ui
diff --git a/src/Makefile.am b/src/Makefile.am
index afa6a34..44fa9ba 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -105,6 +105,7 @@ california_VALAFLAGS = \
 
 california_CFLAGS = \
        -DGETTEXT_PACKAGE=\""california"\" \
+       -DPREFIX=\"$(prefix)\" \
        $(NULL)
 
 california-resources.c: $(california_RC) california-resources.xml
diff --git a/src/application/california-application.vala b/src/application/california-application.vala
index a128800..ebbfd82 100644
--- a/src/application/california-application.vala
+++ b/src/application/california-application.vala
@@ -5,6 +5,8 @@
  */
 
 extern const string PACKAGE_VERSION;
+extern const string GETTEXT_PACKAGE;
+extern const string PREFIX;
 
 namespace California {
 
@@ -13,7 +15,7 @@ namespace California {
  */
 
 public class Application : Gtk.Application {
-    public const string TITLE = "California";
+    public const string TITLE = _("California");
     public const string DESCRIPTION = _("Desktop Calendar");
     public const string COPYRIGHT = _("Copyright 2014 Yorba Foundation");
     public const string VERSION = PACKAGE_VERSION;
@@ -60,6 +62,13 @@ public class Application : Gtk.Application {
     public override void startup() {
         base.startup();
         
+        // prep gettext before initialize various units
+        Intl.setlocale(LocaleCategory.ALL, "");
+        Intl.bindtextdomain(GETTEXT_PACKAGE,
+            File.new_for_path(PREFIX).get_child("share").get_child("locale").get_path());
+        Intl.bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
+        Intl.textdomain(GETTEXT_PACKAGE);
+        
         // unit initialization
         try {
             Host.init();


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