diff options
author | Christian Hergert <chergert@redhat.com> | 2020-01-19 17:23:02 -0800 |
---|---|---|
committer | Christian Hergert <chergert@redhat.com> | 2020-01-19 17:24:43 -0800 |
commit | 75838845ee4c868b3c9db1f596c37ba122979147 (patch) | |
tree | b4b4d6ce89758a06f22d1cc45aa7f5cb909df7a2 | |
parent | ec20d0fac1aa90ed17bbce1dd3ce9354638eef84 (diff) | |
download | libpeas-75838845ee4c868b3c9db1f596c37ba122979147.tar.gz |
demo: setup gettext during startup
The peas-demo app needs to call setlocale(), bind_textdomain_codeset(),
and textdomain() like a normal application to improve testing of
translations.
Related !24
Fixes #35
-rw-r--r-- | peas-demo/peas-demo.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/peas-demo/peas-demo.c b/peas-demo/peas-demo.c index 1ac08c6..47ac005 100644 --- a/peas-demo/peas-demo.c +++ b/peas-demo/peas-demo.c @@ -106,6 +106,15 @@ main (int argc, gchar *plugin_dir; PeasEngine *engine; + setlocale (LC_ALL, ""); + /* Normally, we'd need to call bindtextdomain() here. But that would require + * access to the dynamic peas_dirs_get_locale_dir() which is not available + * via the ABI. However, libpeas has a static constructor for it so we do + * not need to call it anyway. + */ + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + option_context = g_option_context_new (_("— libpeas demo application")); g_option_context_add_main_entries (option_context, demo_args, GETTEXT_PACKAGE); g_option_context_add_group (option_context, gtk_get_option_group (TRUE)); |