diff options
author | Richard Hughes <richard@hughsie.com> | 2016-01-22 11:54:25 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2016-01-22 11:54:25 +0000 |
commit | 3e0634ad292053cfdfa4b29cde18aa8d2a9ee4e2 (patch) | |
tree | 27ea837f8bcde795b2c408c3a372ec1e08cdefd9 | |
parent | d9870a9f93aa8a302ca3b4b7408ef9ea2a6bf442 (diff) | |
download | appstream-glib-wip/alex/compose.tar.gz |
-rw-r--r-- | client/as-compose.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/client/as-compose.c b/client/as-compose.c index 03a5f77..6bca881 100644 --- a/client/as-compose.c +++ b/client/as-compose.c @@ -395,6 +395,9 @@ main (int argc, char **argv) /* load each application specified */ for (i = 1; i < (guint) argc; i++) { const gchar *app_name = argv[i]; + const gchar *gettext_domain; + g_auto(GStrv) intl_domains = NULL; + g_autofree gchar *locale_path = NULL; g_autoptr(AsApp) app_appdata = NULL; g_autoptr(AsApp) app_desktop = NULL; @@ -409,6 +412,29 @@ main (int argc, char **argv) error->message); return EXIT_FAILURE; } + + /* set translations: FIXME add to specification */ + gettext_domain = as_app_get_metadata_item (app_appdata, + "X-Gettext-Domain"); + if (gettext_domain != NULL) { + locale_path = g_build_filename (prefix, + "share", + "locale", + NULL); + intl_domains = g_strsplit (gettext_domain, ",", -1); + if (!as_app_gettext_search_path (app_appdata, + locale_path, + intl_domains, + 25, + NULL, + &error)) { + /* TRANSLATORS: the .mo files could not be parsed */ + g_print ("%s: %s\n", _("Error parsing translations"), + error->message); + return EXIT_FAILURE; + } + } + as_store_add_app (store, app_appdata); app_desktop = load_desktop (prefix, |