diff options
author | Richard Hughes <richard@hughsie.com> | 2016-01-26 15:56:45 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2016-01-26 15:56:55 +0000 |
commit | e740ab00457cd7bbbf5a940d79a356ed0b918d1b (patch) | |
tree | 5ae1e2abd3bfd8001038bda62b873b2aa853a681 /client | |
parent | 50d31f68ffe161195f6aff606f824bdca7805ea9 (diff) | |
download | appstream-glib-e740ab00457cd7bbbf5a940d79a356ed0b918d1b.tar.gz |
Support the QT translation system
Fixes: https://github.com/hughsie/appdata-tools/issues/26
Diffstat (limited to 'client')
-rw-r--r-- | client/as-compose.c | 47 |
1 files changed, 7 insertions, 40 deletions
diff --git a/client/as-compose.c b/client/as-compose.c index c84c660..2ad4357 100644 --- a/client/as-compose.c +++ b/client/as-compose.c @@ -300,29 +300,6 @@ load_appdata (const gchar *prefix, const gchar *app_name, GError **error) } /** - * get_gettext_domains: - **/ -static gchar ** -get_gettext_domains (GPtrArray *translations) -{ - guint i; - guint cnt = 0; - AsTranslation *t; - g_auto(GStrv) intl_domains = NULL; - - intl_domains = g_new0 (gchar *, translations->len + 1); - for (i = 0; i < translations->len; i++) { - t = g_ptr_array_index (translations, i); - if (as_translation_get_kind (t) != AS_TRANSLATION_KIND_GETTEXT) - continue; - intl_domains[cnt++] = g_strdup (as_translation_get_id (t)); - } - if (cnt == 0) - return NULL; - return g_steal_pointer (&intl_domains); -} - -/** * main: **/ int @@ -419,9 +396,7 @@ main (int argc, char **argv) /* load each application specified */ for (i = 1; i < (guint) argc; i++) { const gchar *app_name = argv[i]; - GPtrArray *translations; g_auto(GStrv) intl_domains = NULL; - g_autofree gchar *locale_path = NULL; g_autoptr(AsApp) app_appdata = NULL; g_autoptr(AsApp) app_desktop = NULL; @@ -438,24 +413,16 @@ main (int argc, char **argv) } /* set translations */ - translations = as_app_get_translations (app_appdata); - intl_domains = get_gettext_domains (translations); - if (intl_domains != NULL) { - locale_path = g_build_filename (prefix, - "share", - "locale", - NULL); - if (!as_app_gettext_search_path (app_appdata, - locale_path, - intl_domains, + if (!as_app_builder_search_translations (app_appdata, + prefix, 25, + AS_APP_BUILDER_FLAG_NONE, NULL, &error)) { - /* TRANSLATORS: the .mo files could not be parsed */ - g_print ("%s: %s\n", _("Error parsing translations"), - error->message); - return EXIT_FAILURE; - } + /* 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); |