Set textdomain as soon as possible

This commit is contained in:
JosephMcc 2017-02-09 03:04:04 -08:00
parent e3e316ea8a
commit 42f78a6980
2 changed files with 16 additions and 14 deletions

View File

@ -35,7 +35,6 @@
#include <string.h> #include <string.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
#include <locale.h>
#include <glib/gi18n.h> #include <glib/gi18n.h>
#include <libpeas/peas-extension-set.h> #include <libpeas/peas-extension-set.h>
@ -156,7 +155,7 @@ static const GOptionEntry options[] =
/* collects file arguments */ /* collects file arguments */
{ {
G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, NULL, NULL, G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_FILENAME_ARRAY, NULL, NULL,
N_("[FILE...] [+LINE") N_("[FILE...] [+LINE]")
}, },
{NULL} {NULL}
@ -226,18 +225,6 @@ xed_app_startup (GApplication *application)
/* Setup debugging */ /* Setup debugging */
xed_debug_init (); xed_debug_init ();
xed_debug_message (DEBUG_APP, "Startup"); xed_debug_message (DEBUG_APP, "Startup");
xed_dirs_init ();
/* Setup locale/gettext */
setlocale (LC_ALL, "");
dir = xed_dirs_get_xed_locale_dir ();
bindtextdomain (GETTEXT_PACKAGE, dir);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
xed_debug_message (DEBUG_APP, "Set icon"); xed_debug_message (DEBUG_APP, "Set icon");
dir = xed_dirs_get_xed_data_dir (); dir = xed_dirs_get_xed_data_dir ();

View File

@ -33,7 +33,10 @@
#endif #endif
#include <glib.h> #include <glib.h>
#include <locale.h>
#include <libintl.h>
#include "xed-dirs.h"
#include "xed-app.h" #include "xed-app.h"
int int
@ -41,6 +44,18 @@ main (int argc, char *argv[])
{ {
XedApp *app; XedApp *app;
gint status; gint status;
const gchar *dir;
xed_dirs_init ();
/* Setup locale/gettext */
setlocale (LC_ALL, "");
dir = xed_dirs_get_xed_locale_dir ();
bindtextdomain (GETTEXT_PACKAGE, dir);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
app = g_object_new (XED_TYPE_APP, app = g_object_new (XED_TYPE_APP,
"application-id", "org.x.editor", "application-id", "org.x.editor",