[sysprof] i18n: ensure we setup i18n/l10n during application startup
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [sysprof] i18n: ensure we setup i18n/l10n during application startup
- Date: Tue, 25 Sep 2018 21:38:39 +0000 (UTC)
commit a827b61d637134a763e547abd8ff66408c57564c
Author: Christian Hergert <chergert redhat com>
Date: Tue Sep 25 14:37:03 2018 -0700
i18n: ensure we setup i18n/l10n during application startup
Historically, Sysprof never supported translations. When revamping the
Sysprof implementation we didn't fix that, even though we were able to
start accepting translations.
This ensures we setup the translation tooling at startup.
Fixes #3
config.h.meson | 36 ------------------------------------
meson.build | 3 ++-
src/sp-application.c | 12 +++++++++---
3 files changed, 11 insertions(+), 40 deletions(-)
---
diff --git a/meson.build b/meson.build
index 217f782..285d3a3 100644
--- a/meson.build
+++ b/meson.build
@@ -29,6 +29,8 @@ config_h.set_quoted('DEBUGDIR', debugdir)
config_h.set_quoted('GETTEXT_PACKAGE', 'sysprof')
config_h.set10('ENABLE_NLS', true)
+config_h.set_quoted('PACKAGE_LOCALE_DIR', join_paths(get_option('prefix'), get_option('datadir'), 'locale'))
+config_h.set('LOCALEDIR', 'PACKAGE_LOCALE_DIR')
has_use_clockid = cc.has_member('struct perf_event_attr', 'use_clockid', prefix: '#include
<linux/perf_event.h>')
has_clockid = cc.has_member('struct perf_event_attr', 'clockid', prefix: '#include <linux/perf_event.h>')
@@ -146,7 +148,6 @@ if cc.has_argument('-fPIE')
endif
configure_file(
- input: 'config.h.meson',
output: 'config.h',
configuration: config_h
)
diff --git a/src/sp-application.c b/src/sp-application.c
index 0203ac7..a289239 100644
--- a/src/sp-application.c
+++ b/src/sp-application.c
@@ -16,9 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
+#include "config.h"
#include <glib/gi18n.h>
@@ -320,6 +318,14 @@ sp_application_init (SpApplication *self)
{ "quit", sysprof_quit },
};
+ setlocale (LC_ALL, "");
+
+ bindtextdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR);
+ bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+ textdomain (GETTEXT_PACKAGE);
+
+ g_set_application_name (_("Sysprof"));
+
g_action_map_add_action_entries (G_ACTION_MAP (self), actions, G_N_ELEMENTS (actions), self);
g_application_set_default (G_APPLICATION (self));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]