[gnome-photos] application, main: Set up internationalization in PhotosApplication



commit c7fa6e6457105cf42bcf64b7161ace764766047c
Author: Debarshi Ray <debarshir gnome org>
Date:   Fri Jan 5 17:37:49 2018 +0100

    application, main: Set up internationalization in PhotosApplication
    
    Ideally main() should only instantiate PhotosApplication and run it,
    plus anything that needs to happen really early or late in the process'
    lifecycle. Internationalization isn't needed until there is some
    user-visible output, either from the application or the search
    provider, which can only happen once PhotosApplication has been
    created.

 src/photos-application.c | 7 +++++++
 src/photos-main.c        | 9 ---------
 2 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/src/photos-application.c b/src/photos-application.c
index be9efe63..69fa4666 100644
--- a/src/photos-application.c
+++ b/src/photos-application.c
@@ -28,6 +28,7 @@
 
 #include "config.h"
 
+#include <locale.h>
 #include <stdlib.h>
 
 #include <gdesktop-enums.h>
@@ -2220,6 +2221,12 @@ photos_application_finalize (GObject *object)
 static void
 photos_application_init (PhotosApplication *self)
 {
+  setlocale (LC_ALL, "");
+
+  bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+  bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+  textdomain (GETTEXT_PACKAGE);
+
   g_set_application_name (_("Photos"));
 
   photos_utils_ensure_builtins ();
diff --git a/src/photos-main.c b/src/photos-main.c
index 2b328234..30e97e73 100644
--- a/src/photos-main.c
+++ b/src/photos-main.c
@@ -25,10 +25,7 @@
 
 #include "config.h"
 
-#include <locale.h>
-
 #include <glib.h>
-#include <glib/gi18n.h>
 
 #include "egg-counter.h"
 #include "photos-application.h"
@@ -56,14 +53,8 @@ main (gint argc, gchar *argv[])
     g_autoptr (GApplication) app = NULL;
     g_autoptr (PhotosRemoteDisplayManager) remote_display_mngr = NULL;
 
-    setlocale (LC_ALL, "");
-
     photos_debug_init ();
 
-    bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
-    bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
-    textdomain (GETTEXT_PACKAGE);
-
     g_set_prgname (PACKAGE_TARNAME);
 
     app = photos_application_new ();


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