diff options
author | Juan A. Suarez Romero <jasuarez@igalia.com> | 2013-03-20 13:42:29 +0000 |
---|---|---|
committer | Juan A. Suarez Romero <jasuarez@igalia.com> | 2013-03-21 13:44:33 +0000 |
commit | f1ffa5d0e7d66da7c7f50c21fd2e3ce981536d49 (patch) | |
tree | 716a2ed44c126ec2da2e5dc4797171c949e0d4cd | |
parent | ea058d290c850de294bf0ca5a03c62db89c4d077 (diff) |
all: Add support for internationalization
Add i18n support.
https://bugzilla.gnome.org/show_bug.cgi?id=673496
47 files changed, 498 insertions, 311 deletions
diff --git a/Makefile.am b/Makefile.am index 4e63029..eaaf008 100644 --- a/Makefile.am +++ b/Makefile.am @@ -7,7 +7,7 @@ ACLOCAL_AMFLAGS = -I m4 -SUBDIRS = src help test +SUBDIRS = src help po test MAINTAINERCLEANFILES = \ aclocal.m4 \ diff --git a/configure.ac b/configure.ac index 221a44a..319ce23 100644 --- a/configure.ac +++ b/configure.ac @@ -1025,12 +1025,13 @@ DEPS_TMDB_LIBS="$DEPS_LIBS $LIBSOUP_LIBS $GRLNET_LIBS $JSON_LIBS" AC_SUBST(DEPS_TMDB_LIBS) # ---------------------------------------------------------- -# GETTEXT +# GETTEXT/INTLTOOL # ---------------------------------------------------------- -#GETTEXT_PACKAGE=grilo -#AC_SUBST(GETTEXT_PACKAGE) -#AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [Gettext package]) +IT_PROG_INTLTOOL([0.40.0]) +GETTEXT_PACKAGE=grilo-plugins +AC_SUBST(GETTEXT_PACKAGE) +AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [The domain to use with gettext]) #AM_GLIB_GNU_GETTEXT @@ -1052,6 +1053,8 @@ AC_CONFIG_FILES([ Makefile help/Makefile help/examples/Makefile + po/Makefile.in + po/Makefile src/Makefile src/apple-trailers/Makefile src/bliptv/Makefile diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/po/LINGUAS diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..f4bdedb --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1,23 @@ +src/apple-trailers/grl-apple-trailers.c +src/bliptv/grl-bliptv.c +src/bookmarks/grl-bookmarks.c +src/dmap/grl-dmap.c +src/filesystem/grl-filesystem.c +src/flickr/grl-flickr.c +src/gravatar/grl-gravatar.c +src/jamendo/grl-jamendo.c +src/lastfm-albumart/grl-lastfm-albumart.c +src/local-metadata/grl-local-metadata.c +src/metadata-store/grl-metadata-store.c +src/optical-media/grl-optical-media.c +src/podcasts/grl-podcasts.c +src/raitv/grl-raitv.c +src/shoutcast/grl-shoutcast.c +src/tmdb/grl-tmdb.c +src/tracker/grl-tracker-source-api.c +src/tracker/grl-tracker-source-priv.h +src/tracker/grl-tracker-utils.c +src/tracker/grl-tracker.c +src/upnp/grl-upnp.c +src/vimeo/grl-vimeo.c +src/youtube/grl-youtube.c diff --git a/src/apple-trailers/Makefile.am b/src/apple-trailers/Makefile.am index e55a0a2..9b6f3bf 100644 --- a/src/apple-trailers/Makefile.am +++ b/src/apple-trailers/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrlappletrailers.la libgrlappletrailers_la_CFLAGS = \ - $(DEPS_APPLE_TRAILERS_CFLAGS) + $(DEPS_APPLE_TRAILERS_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlappletrailers_la_LIBADD = \ $(DEPS_APPLE_TRAILERS_LIBS) diff --git a/src/apple-trailers/grl-apple-trailers.c b/src/apple-trailers/grl-apple-trailers.c index 9da3f32..af131fa 100644 --- a/src/apple-trailers/grl-apple-trailers.c +++ b/src/apple-trailers/grl-apple-trailers.c @@ -30,6 +30,7 @@ #include <grilo.h> #include <net/grl-net.h> #include <libxml/xpath.h> +#include <glib/gi18n-lib.h> #include "grl-apple-trailers.h" @@ -51,8 +52,8 @@ GRL_LOG_DOMAIN_STATIC(apple_trailers_log_domain); #define PLUGIN_ID APPLE_TRAILERS_PLUGIN_ID #define SOURCE_ID "grl-apple-trailers" -#define SOURCE_NAME "Apple Movie Trailers" -#define SOURCE_DESC "A plugin for browsing Apple Movie Trailers" +#define SOURCE_NAME _("Apple Movie Trailers") +#define SOURCE_DESC _("A plugin for browsing Apple Movie Trailers") typedef struct { GrlSourceBrowseSpec *bs; @@ -109,6 +110,10 @@ grl_apple_trailers_plugin_init (GrlRegistry *registry, GRL_DEBUG ("apple_trailers_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + for (; configs; configs = g_list_next (configs)) { GrlConfig *config; gchar *definition, *poster_size; @@ -447,17 +452,17 @@ xml_parse_result (const gchar *str, OperationData *op_data) op_data->xml_doc = xmlReadMemory (str, xmlStrlen ((xmlChar*) str), NULL, NULL, XML_PARSE_RECOVER | XML_PARSE_NOBLANKS); if (!op_data->xml_doc) { - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_BROWSE_FAILED, - "Failed to parse response"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_BROWSE_FAILED, + _("Failed to parse response")); goto finalize; } node = xmlDocGetRootElement (op_data->xml_doc); if (!node || !node->xmlChildrenNode) { - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_BROWSE_FAILED, - "Empty response from Apple Trailers"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_BROWSE_FAILED, + _("Empty response")); goto finalize; } @@ -515,7 +520,7 @@ read_done_cb (GObject *source_object, &wc_error)) { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_BROWSE_FAILED, - "Failed to connect Apple Trailers: '%s'", + _("Failed to connect: %s"), wc_error->message); op_data->bs->callback (op_data->bs->source, op_data->bs->operation_id, diff --git a/src/bliptv/Makefile.am b/src/bliptv/Makefile.am index 0654312..023f858 100644 --- a/src/bliptv/Makefile.am +++ b/src/bliptv/Makefile.am @@ -9,7 +9,8 @@ ext_LTLIBRARIES = libgrlbliptv.la libgrlbliptv_la_CFLAGS = \ - $(DEPS_BLIPTV_CFLAGS) + $(DEPS_BLIPTV_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlbliptv_la_LIBADD = \ $(DEPS_BLIPTV_LIBS) diff --git a/src/bliptv/grl-bliptv.c b/src/bliptv/grl-bliptv.c index 407c8c0..b1dcf1b 100644 --- a/src/bliptv/grl-bliptv.c +++ b/src/bliptv/grl-bliptv.c @@ -31,6 +31,7 @@ #include <net/grl-net.h> +#include <glib/gi18n-lib.h> #include <libxml/parser.h> #include <libxml/xpath.h> #include <libxml/xpathInternals.h> @@ -56,7 +57,7 @@ GRL_LOG_DOMAIN_STATIC(bliptv_log_domain); #define SOURCE_ID "grl-bliptv" #define SOURCE_NAME "Blip.tv" -#define SOURCE_DESC "A source for browsing and searching Blip.tv videos" +#define SOURCE_DESC _("A source for browsing and searching Blip.tv videos") G_DEFINE_TYPE (GrlBliptvSource, grl_bliptv_source, GRL_TYPE_SOURCE) @@ -122,6 +123,10 @@ grl_bliptv_plugin_init (GrlRegistry *registry, { GRL_LOG_DOMAIN_INIT (bliptv_log_domain, "bliptv"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + bliptv_setup_mapping (); GrlBliptvSource *source = grl_bliptv_source_new (); diff --git a/src/bookmarks/Makefile.am b/src/bookmarks/Makefile.am index 22aeec1..d727b6a 100644 --- a/src/bookmarks/Makefile.am +++ b/src/bookmarks/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrlbookmarks.la libgrlbookmarks_la_CFLAGS = \ - $(DEPS_BOOKMARKS_CFLAGS) + $(DEPS_BOOKMARKS_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlbookmarks_la_LIBADD = \ $(DEPS_BOOKMARKS_LIBS) diff --git a/src/bookmarks/grl-bookmarks.c b/src/bookmarks/grl-bookmarks.c index 3a1b1b7..4f8421f 100644 --- a/src/bookmarks/grl-bookmarks.c +++ b/src/bookmarks/grl-bookmarks.c @@ -26,6 +26,7 @@ #include <glib.h> #include <glib/gstdio.h> +#include <glib/gi18n-lib.h> #include <grilo.h> #include <sqlite3.h> #include <string.h> @@ -115,8 +116,8 @@ GRL_LOG_DOMAIN_STATIC(bookmarks_log_domain); #define PLUGIN_ID BOOKMARKS_PLUGIN_ID #define SOURCE_ID "grl-bookmarks" -#define SOURCE_NAME "Bookmarks" -#define SOURCE_DESC "A source for organizing media bookmarks" +#define SOURCE_NAME _("Bookmarks") +#define SOURCE_DESC _("A source for organizing media bookmarks") GrlKeyID GRL_BOOKMARKS_KEY_BOOKMARK_TIME = 0; @@ -192,6 +193,10 @@ static gboolean grl_bookmarks_source_notify_change_stop (GrlSource *source, GRL_DEBUG ("grl_bookmarks_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + spec = g_param_spec_boxed ("bookmark-date", "Bookmark date", "When the media was bookmarked", @@ -431,9 +436,9 @@ bookmark_resolve (GrlSourceResolveSpec *rs) if (r != SQLITE_OK) { GRL_WARNING ("Failed to get bookmark: %s", sqlite3_errmsg (db)); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_RESOLVE_FAILED, - "Failed to get bookmark metadata"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("Failed to get bookmark metadata")); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); return; @@ -446,9 +451,9 @@ bookmark_resolve (GrlSourceResolveSpec *rs) rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL); } else { GRL_WARNING ("Failed to get bookmark: %s", sqlite3_errmsg (db)); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_RESOLVE_FAILED, - "Failed to get bookmark metadata"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("Failed to get bookmark metadata")); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); } @@ -477,8 +482,9 @@ produce_bookmarks_from_sql (OperationSpec *os, const gchar *sql) if (r != SQLITE_OK) { GRL_WARNING ("Failed to retrieve bookmarks: %s", sqlite3_errmsg (db)); error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to retrieve bookmarks list"); + os->error_code, + _("Failed to get bookmarks list: %s"), + sqlite3_errmsg (db)); os->callback (os->source, os->operation_id, NULL, 0, os->user_data, error); g_error_free (error); goto free_resources; @@ -496,8 +502,9 @@ produce_bookmarks_from_sql (OperationSpec *os, const gchar *sql) if (r != SQLITE_DONE) { GRL_WARNING ("Failed to retrieve bookmarks: %s", sqlite3_errmsg (db)); error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to retrieve bookmarks list"); + os->error_code, + _("Failed to get bookmarks list: %s"), + sqlite3_errmsg (db)); os->callback (os->source, os->operation_id, NULL, 0, os->user_data, error); g_error_free (error); goto free_resources; @@ -581,8 +588,9 @@ remove_bookmark (GrlBookmarksSource *bookmarks_source, if (r != SQLITE_OK) { GRL_WARNING ("Failed to remove bookmark '%s': %s", bookmark_id, sql_error); *error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_REMOVE_FAILED, - "Failed to remove bookmark"); + GRL_CORE_ERROR_REMOVE_FAILED, + _("Failed to remove: %s"), + sql_error); sqlite3_free (sql_error); } @@ -648,8 +656,9 @@ store_bookmark (GrlBookmarksSource *bookmarks_source, GRL_WARNING ("Failed to store bookmark '%s': %s", title, sqlite3_errmsg (bookmarks_source->priv->db)); *error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_STORE_FAILED, - "Failed to store bookmark '%s'", title); + GRL_CORE_ERROR_STORE_FAILED, + _("Failed to store: %s"), + sqlite3_errmsg (bookmarks_source->priv->db)); return; } @@ -705,8 +714,9 @@ store_bookmark (GrlBookmarksSource *bookmarks_source, GRL_WARNING ("Failed to store bookmark '%s': %s", title, sqlite3_errmsg (bookmarks_source->priv->db)); *error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_STORE_FAILED, - "Failed to store bookmark '%s'", title); + GRL_CORE_ERROR_STORE_FAILED, + _("Failed to store: %s"), + sqlite3_errmsg (bookmarks_source->priv->db)); sqlite3_finalize (sql_stmt); return; } @@ -757,9 +767,9 @@ grl_bookmarks_source_browse (GrlSource *source, bookmarks_source = GRL_BOOKMARKS_SOURCE (source); if (!bookmarks_source->priv->db) { GRL_WARNING ("Can't execute operation: no database connection."); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_BROWSE_FAILED, - "No database connection"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_BROWSE_FAILED, + _("No database connection")); bs->callback (bs->source, bs->operation_id, NULL, 0, bs->user_data, error); g_error_free (error); } @@ -792,9 +802,9 @@ grl_bookmarks_source_search (GrlSource *source, bookmarks_source = GRL_BOOKMARKS_SOURCE (source); if (!bookmarks_source->priv->db) { GRL_WARNING ("Can't execute operation: no database connection."); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_QUERY_FAILED, - "No database connection"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_QUERY_FAILED, + _("No database connection")); ss->callback (ss->source, ss->operation_id, NULL, 0, ss->user_data, error); g_error_free (error); } @@ -824,9 +834,9 @@ grl_bookmarks_source_query (GrlSource *source, bookmarks_source = GRL_BOOKMARKS_SOURCE (source); if (!bookmarks_source->priv->db) { GRL_WARNING ("Can't execute operation: no database connection."); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_QUERY_FAILED, - "No database connection"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_QUERY_FAILED, + _("No database connection")); qs->callback (qs->source, qs->operation_id, NULL, 0, qs->user_data, error); g_error_free (error); } @@ -886,9 +896,9 @@ grl_bookmarks_source_resolve (GrlSource *source, bookmarks_source = GRL_BOOKMARKS_SOURCE (source); if (!bookmarks_source->priv->db) { GRL_WARNING ("Can't execute operation: no database connection."); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_RESOLVE_FAILED, - "No database connection"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("No database connection")); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); } diff --git a/src/dmap/Makefile.am b/src/dmap/Makefile.am index 4d285ab..e565e3c 100644 --- a/src/dmap/Makefile.am +++ b/src/dmap/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrldmap.la libgrldmap_la_CFLAGS = \ - $(DEPS_DMAP_CFLAGS) + $(DEPS_DMAP_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrldmap_la_LIBADD = \ $(DEPS_DMAP_LIBS) diff --git a/src/dmap/grl-dmap.c b/src/dmap/grl-dmap.c index c7d65ef..a2c3d1d 100644 --- a/src/dmap/grl-dmap.c +++ b/src/dmap/grl-dmap.c @@ -27,6 +27,7 @@ #include <errno.h> #include <grilo.h> +#include <glib/gi18n-lib.h> #include <gio/gio.h> #include <string.h> #include <stdlib.h> @@ -47,7 +48,7 @@ GRL_LOG_DOMAIN_STATIC(dmap_log_domain); #define PLUGIN_ID DMAP_PLUGIN_ID #define SOURCE_ID_TEMPLATE "grl-dmap-%s" -#define SOURCE_DESC_TEMPLATE "A source for browsing the DMAP server '%s'" +#define SOURCE_DESC_TEMPLATE _("A source for browsing the DMAP server '%s'") /* --- Grilo DMAP Private --- */ @@ -123,6 +124,10 @@ grl_dmap_plugin_init (GrlRegistry *registry, GRL_DEBUG ("dmap_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + browser = dmap_mdns_browser_new (DMAP_MDNS_BROWSER_SERVICE_TYPE_DAAP); connections = g_hash_table_new (g_str_hash, g_str_equal); sources = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, g_object_unref); diff --git a/src/filesystem/Makefile.am b/src/filesystem/Makefile.am index e9b1441..5b4eff6 100644 --- a/src/filesystem/Makefile.am +++ b/src/filesystem/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrlfilesystem.la libgrlfilesystem_la_CFLAGS = \ - $(DEPS_FILESYSTEM_CFLAGS) + $(DEPS_FILESYSTEM_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlfilesystem_la_LIBADD = \ $(DEPS_FILESYSTEM_LIBS) diff --git a/src/filesystem/grl-filesystem.c b/src/filesystem/grl-filesystem.c index 45f3c8c..89cd880 100644 --- a/src/filesystem/grl-filesystem.c +++ b/src/filesystem/grl-filesystem.c @@ -27,6 +27,7 @@ #include <grilo.h> #include <gio/gio.h> +#include <glib/gi18n-lib.h> #include <string.h> #include <stdlib.h> @@ -60,8 +61,8 @@ GRL_LOG_DOMAIN_STATIC(filesystem_log_domain); #define PLUGIN_ID FILESYSTEM_PLUGIN_ID #define SOURCE_ID "grl-filesystem" -#define SOURCE_NAME "Filesystem" -#define SOURCE_DESC "A source for browsing the filesystem" +#define SOURCE_NAME _("Filesystem") +#define SOURCE_DESC _("A source for browsing the filesystem") /* --- Grilo Filesystem Private --- */ @@ -166,6 +167,10 @@ grl_filesystem_plugin_init (GrlRegistry *registry, GRL_DEBUG ("filesystem_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + GrlFilesystemSource *source = grl_filesystem_source_new (); for (; configs; configs = g_list_next (configs)) { @@ -1313,7 +1318,7 @@ grl_filesystem_source_resolve (GrlSource *source, } else { GError *error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "File '%s' does not exist", + _("File %s does not exist"), path); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); @@ -1364,7 +1369,7 @@ static void grl_filesystem_get_media_from_uri (GrlSource *source, if (!ret) { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED, - "Cannot create media from '%s'", mfus->uri); + _("Cannot get media from %s"), mfus->uri); mfus->callback (source, mfus->operation_id, NULL, mfus->user_data, error); g_clear_error (&error); return; @@ -1374,9 +1379,9 @@ static void grl_filesystem_get_media_from_uri (GrlSource *source, if (error != NULL) { GError *new_error; new_error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED, - "Cannot create media from '%s', error message: %s", - mfus->uri, error->message); + GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED, + _("Cannot get media from %s: %s"), + mfus->uri, error->message); g_clear_error (&error); mfus->callback (source, mfus->operation_id, NULL, mfus->user_data, new_error); g_clear_error (&new_error); diff --git a/src/flickr/Makefile.am b/src/flickr/Makefile.am index 5bdc09f..6fc3081 100644 --- a/src/flickr/Makefile.am +++ b/src/flickr/Makefile.am @@ -8,7 +8,8 @@ libplugin_LTLIBRARIES = libgrlflickr.la libgrlflickr_la_CFLAGS = \ - $(DEPS_FLICKR_CFLAGS) + $(DEPS_FLICKR_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlflickr_la_LIBADD = \ $(DEPS_FLICKR_LIBS) diff --git a/src/flickr/grl-flickr.c b/src/flickr/grl-flickr.c index baa23d8..a757e15 100644 --- a/src/flickr/grl-flickr.c +++ b/src/flickr/grl-flickr.c @@ -29,6 +29,7 @@ #endif #include <grilo.h> +#include <glib/gi18n-lib.h> #include <string.h> #include <stdlib.h> @@ -54,11 +55,13 @@ GRL_LOG_DOMAIN(flickr_log_domain); #define PUBLIC_SOURCE_ID "grl-flickr" #define PUBLIC_SOURCE_NAME "Flickr" -#define PUBLIC_SOURCE_DESC "A source for browsing and searching Flickr photos" +#define PUBLIC_SOURCE_DESC _("A source for browsing and searching Flickr photos") #define PERSONAL_SOURCE_ID "grl-flickr-%s" -#define PERSONAL_SOURCE_NAME "%s's Flickr" -#define PERSONAL_SOURCE_DESC "A source for browsing and searching %s' flickr photos" +/* "%s" is a full user name, like "John Doe" */ +#define PERSONAL_SOURCE_NAME _("%s's Flickr") +/* "%s" is a full user name, like "John Doe" */ +#define PERSONAL_SOURCE_DESC _("A source for browsing and searching %s' flickr photos") typedef struct { GrlSource *source; @@ -125,6 +128,10 @@ grl_flickr_plugin_init (GrlRegistry *registry, GRL_DEBUG ("flickr_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + if (!configs) { GRL_INFO ("Configuration not provided! Plugin not loaded"); return FALSE; diff --git a/src/gravatar/Makefile.am b/src/gravatar/Makefile.am index 8cbf4a2..2ab5d3f 100644 --- a/src/gravatar/Makefile.am +++ b/src/gravatar/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrlgravatar.la libgrlgravatar_la_CFLAGS = \ - $(DEPS_GRAVATAR_CFLAGS) + $(DEPS_GRAVATAR_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlgravatar_la_LIBADD = \ $(DEPS_GRAVATAR_LIBS) diff --git a/src/gravatar/grl-gravatar.c b/src/gravatar/grl-gravatar.c index 259a2ac..a26f276 100644 --- a/src/gravatar/grl-gravatar.c +++ b/src/gravatar/grl-gravatar.c @@ -29,6 +29,8 @@ #include "grl-gravatar.h" +#include <glib/gi18n-lib.h> + /* ---------- Logging ---------- */ #define GRL_LOG_DOMAIN_DEFAULT gravatar_log_domain @@ -43,8 +45,8 @@ GRL_LOG_DOMAIN_STATIC(gravatar_log_domain); #define PLUGIN_ID GRAVATAR_PLUGIN_ID #define SOURCE_ID PLUGIN_ID -#define SOURCE_NAME "Avatar provider from Gravatar" -#define SOURCE_DESC "A plugin to get avatars for artist and author fields" +#define SOURCE_NAME _("Avatar provider from Gravatar") +#define SOURCE_DESC _("A plugin to get avatars for artist and author fields") static GrlGravatarSource *grl_gravatar_source_new (void); @@ -81,6 +83,10 @@ grl_gravatar_source_plugin_init (GrlRegistry *registry, GRL_DEBUG ("grl_gravatar_source_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + /* Register keys */ GRL_METADATA_KEY_ARTIST_AVATAR = register_gravatar_key (registry, diff --git a/src/jamendo/Makefile.am b/src/jamendo/Makefile.am index 4e0acc3..8e51821 100644 --- a/src/jamendo/Makefile.am +++ b/src/jamendo/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrljamendo.la libgrljamendo_la_CFLAGS = \ - $(DEPS_JAMENDO_CFLAGS) + $(DEPS_JAMENDO_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrljamendo_la_LIBADD = \ $(DEPS_JAMENDO_LIBS) diff --git a/src/jamendo/grl-jamendo.c b/src/jamendo/grl-jamendo.c index f7f7702..729700e 100644 --- a/src/jamendo/grl-jamendo.c +++ b/src/jamendo/grl-jamendo.c @@ -27,6 +27,7 @@ #endif #include <grilo.h> +#include <glib/gi18n-lib.h> #include <net/grl-net.h> #include <libxml/parser.h> #include <libxml/xmlmemory.h> @@ -89,7 +90,7 @@ GRL_LOG_DOMAIN_STATIC(jamendo_log_domain); #define SOURCE_ID "grl-jamendo" #define SOURCE_NAME "Jamendo" -#define SOURCE_DESC "A source for browsing and searching Jamendo music" +#define SOURCE_DESC _("A source for browsing and searching Jamendo music") enum { RESOLVE, @@ -145,17 +146,17 @@ struct Feeds { JamendoCategory cat; gchar *url; } feeds[] = { - { "Albums of the week", JAMENDO_ALBUM_CAT, + { N_("Albums of the week"), JAMENDO_ALBUM_CAT, JAMENDO_GET_ALBUMS "&order=ratingweek_desc", }, - { "Tracks of the week", JAMENDO_TRACK_CAT, + { N_("Tracks of the week"), JAMENDO_TRACK_CAT, JAMENDO_GET_TRACKS "&order=ratingweek_desc", }, - { "New releases", JAMENDO_TRACK_CAT, + { N_("New releases"), JAMENDO_TRACK_CAT, JAMENDO_GET_TRACKS "&order=releasedate_desc", }, - { "Top artists", JAMENDO_ARTIST_CAT, + { N_("Top artists"), JAMENDO_ARTIST_CAT, JAMENDO_GET_ARTISTS "&order=rating_desc", }, - { "Top albums", JAMENDO_ALBUM_CAT, + { N_("Top albums"), JAMENDO_ALBUM_CAT, JAMENDO_GET_ALBUMS "&order=rating_desc", }, - { "Top tracks", JAMENDO_TRACK_CAT, + { N_("Top tracks"), JAMENDO_TRACK_CAT, JAMENDO_GET_TRACKS "&order=rating_desc", }, }; @@ -203,6 +204,10 @@ grl_jamendo_plugin_init (GrlRegistry *registry, GRL_TRACE (); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + GrlJamendoSource *source = grl_jamendo_source_new (); grl_registry_register_source (registry, plugin, @@ -326,24 +331,24 @@ xml_parse_result (const gchar *str, GError **error, XmlParseEntries *xpe) doc = xmlReadMemory (str, strlen (str), NULL, NULL, XML_PARSE_RECOVER | XML_PARSE_NOBLANKS); if (!doc) { - *error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_BROWSE_FAILED, - "Failed to parse Jamendo's response"); + *error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_BROWSE_FAILED, + _("Failed to parse response")); goto free_resources; } node = xmlDocGetRootElement (doc); if (!node) { - *error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_BROWSE_FAILED, - "Empty response from Jamendo"); + *error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_BROWSE_FAILED, + _("Empty response")); goto free_resources; } if (xmlStrcmp (node->name, (const xmlChar *) "data")) { - *error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_BROWSE_FAILED, - "Unexpected response from Jamendo: no data"); + *error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_BROWSE_FAILED, + _("Empty response")); goto free_resources; } @@ -658,7 +663,7 @@ read_done_cb (GObject *source_object, error = g_error_new (GRL_CORE_ERROR, error_code, - "Failed to connect Jamendo: '%s'", + _("Failed to connect: %s"), wc_error->message); g_error_free (wc_error); goto invoke_cb; @@ -686,10 +691,9 @@ read_done_cb (GObject *source_object, } } else { if (xpe->type == RESOLVE) { - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_RESOLVE_FAILED, - "Unable to get information: '%s'", - grl_media_get_id (xpe->spec.rs->media)); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("Failed to parse response")); } goto invoke_cb; } @@ -767,7 +771,7 @@ update_media_from_artists (GrlMedia *media) { Entry entry = { .category = JAMENDO_ARTIST_CAT, - .artist_name = "Artists", + .artist_name = _("Artists"), }; update_media_from_entry (media, &entry); @@ -778,7 +782,7 @@ update_media_from_albums (GrlMedia *media) { Entry entry = { .category = JAMENDO_ALBUM_CAT, - .album_name = "Albums", + .album_name = _("Albums"), }; update_media_from_entry (media, &entry); @@ -789,7 +793,7 @@ update_media_from_feeds (GrlMedia *media) { Entry entry = { .category = JAMENDO_FEEDS_CAT, - .feed_name = "Feeds", + .feed_name = _("Feeds"), }; update_media_from_entry (media, &entry); @@ -842,7 +846,7 @@ update_media_from_feed (GrlMedia *media, int i) grl_media_set_id (media, id); g_free (id); - grl_media_set_title (media, feeds[i].name); + grl_media_set_title (media, g_dgettext (GETTEXT_PACKAGE, feeds[i].name)); } @@ -975,7 +979,7 @@ grl_jamendo_source_resolve (GrlSource *source, if (g_strv_length (id_split) == 0) { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "Invalid id: '%s'", + _("Invalid identifier %s"), id); goto send_error; } @@ -1020,7 +1024,7 @@ grl_jamendo_source_resolve (GrlSource *source, } else { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "Invalid id: '%s'", + _("Invalid identifier %s"), id); g_strfreev (id_split); goto send_error; @@ -1034,7 +1038,8 @@ grl_jamendo_source_resolve (GrlSource *source, if (errno != 0 || (i <= 0 && i > G_N_ELEMENTS (feeds))) { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "Invalid cat id: '%s'", id_split[1]); + _("Invalid category identifier %s"), + id_split[1]); g_strfreev (id_split); goto send_error; } @@ -1046,7 +1051,7 @@ grl_jamendo_source_resolve (GrlSource *source, } else { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "Invalid id: '%s'", + _("Invalid identifier %s"), id); g_strfreev (id_split); goto send_error; @@ -1108,7 +1113,7 @@ grl_jamendo_source_browse (GrlSource *source, if (g_strv_length (container_split) == 0) { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_BROWSE_FAILED, - "Invalid container-id: '%s'", + _("Invalid container identifier %s"), container_id); } else { category = atoi (container_split[0]); @@ -1178,12 +1183,12 @@ grl_jamendo_source_browse (GrlSource *source, } else if (category == JAMENDO_TRACK_CAT) { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_BROWSE_FAILED, - "Cannot browse through a track: '%s'", + _("Failed to browse: %s is a track"), container_id); } else { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_BROWSE_FAILED, - "Invalid container-id: '%s'", + _("Invalid container identifier %s"), container_id); } } @@ -1240,7 +1245,7 @@ grl_jamendo_source_query (GrlSource *source, if (!parse_query (qs->query, &category, &term)) { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_QUERY_FAILED, - "Query malformed: '%s'", + _("Malformed query \"%s\""), qs->query); goto send_error; } diff --git a/src/lastfm-albumart/Makefile.am b/src/lastfm-albumart/Makefile.am index 914df03..a2a5335 100644 --- a/src/lastfm-albumart/Makefile.am +++ b/src/lastfm-albumart/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrllastfm-albumart.la libgrllastfm_albumart_la_CFLAGS = \ - $(DEPS_LASTFM_ALBUMART_CFLAGS) + $(DEPS_LASTFM_ALBUMART_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrllastfm_albumart_la_LIBADD = \ $(DEPS_LASTFM_ALBUMART_LIBS) diff --git a/src/lastfm-albumart/grl-lastfm-albumart.c b/src/lastfm-albumart/grl-lastfm-albumart.c index 1b9eb2e..dcd3670 100644 --- a/src/lastfm-albumart/grl-lastfm-albumart.c +++ b/src/lastfm-albumart/grl-lastfm-albumart.c @@ -27,6 +27,7 @@ #endif #include <net/grl-net.h> +#include <glib/gi18n-lib.h> #include <libxml/parser.h> #include <libxml/xmlmemory.h> #include <libxml/xpath.h> @@ -55,8 +56,8 @@ GRL_LOG_DOMAIN_STATIC(lastfm_albumart_log_domain); #define PLUGIN_ID LASTFM_ALBUMART_PLUGIN_ID #define SOURCE_ID "grl-lastfm-albumart" -#define SOURCE_NAME "Album art Provider from Last.FM" -#define SOURCE_DESC "A plugin for getting album arts using Last.FM as backend" +#define SOURCE_NAME _("Album art Provider from Last.FM") +#define SOURCE_DESC _("A plugin for getting album arts using Last.FM as backend") static GrlNetWc *wc; @@ -93,6 +94,10 @@ grl_lastfm_albumart_source_plugin_init (GrlRegistry *registry, GRL_DEBUG ("grl_lastfm_albumart_source_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + GrlLastfmAlbumartSource *source = grl_lastfm_albumart_source_new (); grl_registry_register_source (registry, plugin, @@ -221,7 +226,7 @@ read_done_cb (GObject *source_object, } else { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "Failed to connect to Last.FM: '%s'", + _("Failed to connect: %s"), wc_error->message); g_error_free (wc_error); } diff --git a/src/local-metadata/Makefile.am b/src/local-metadata/Makefile.am index 9bd7461..fddfbd9 100644 --- a/src/local-metadata/Makefile.am +++ b/src/local-metadata/Makefile.am @@ -8,7 +8,9 @@ ext_LTLIBRARIES = libgrllocalmetadata.la libgrllocalmetadata_la_CFLAGS = \ - $(DEPS_LOCALMETADATA_CFLAGS) + $(DEPS_LOCALMETADATA_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" + libgrllocalmetadata_la_LIBADD = \ $(DEPS_LOCALMETADATA_LIBS) diff --git a/src/local-metadata/grl-local-metadata.c b/src/local-metadata/grl-local-metadata.c index ab713a8..421f0e3 100644 --- a/src/local-metadata/grl-local-metadata.c +++ b/src/local-metadata/grl-local-metadata.c @@ -29,6 +29,7 @@ #include <grilo.h> #include <gio/gio.h> +#include <glib/gi18n-lib.h> #include "grl-local-metadata.h" @@ -38,8 +39,8 @@ GRL_LOG_DOMAIN_STATIC(local_metadata_log_domain); #define PLUGIN_ID LOCALMETADATA_PLUGIN_ID #define SOURCE_ID "grl-local-metadata" -#define SOURCE_NAME "Local Metadata Provider" -#define SOURCE_DESC "A source providing locally available metadata" +#define SOURCE_NAME _("Local Metadata Provider") +#define SOURCE_DESC _("A source providing locally available metadata") /**/ @@ -135,6 +136,10 @@ grl_local_metadata_source_plugin_init (GrlRegistry *registry, GRL_DEBUG ("grl_local_metadata_source_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + if (!configs) { GRL_INFO ("\tConfiguration not provided! Using default configuration."); } else { @@ -462,8 +467,10 @@ got_file_info (GFile *file, error: { - GError *new_error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "Got error: %s", error->message); + GError *new_error = g_error_new (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("Failed to resolve: %s"), + error->message); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, new_error); g_error_free (error); @@ -983,11 +990,13 @@ grl_local_metadata_source_resolve (GrlSource *source, flags = get_resolution_flags (rs->keys); if (!flags) - error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "local-metadata cannot resolve any of the given keys"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("Cannot resolve any of the given keys")); if (GRL_IS_MEDIA_IMAGE (rs->media) && can_access == FALSE) - error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "local-metadata needs a GIO supported URL for images"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("A GIO supported URL for images is required")); if (error) { /* No can do! */ diff --git a/src/metadata-store/Makefile.am b/src/metadata-store/Makefile.am index d7128ce..700b0a8 100644 --- a/src/metadata-store/Makefile.am +++ b/src/metadata-store/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrlmetadatastore.la libgrlmetadatastore_la_CFLAGS = \ - $(DEPS_METADATA_STORE_CFLAGS) + $(DEPS_METADATA_STORE_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlmetadatastore_la_LIBADD = \ $(DEPS_METADATA_STORE_LIBS) diff --git a/src/metadata-store/grl-metadata-store.c b/src/metadata-store/grl-metadata-store.c index 143c58d..292fc01 100644 --- a/src/metadata-store/grl-metadata-store.c +++ b/src/metadata-store/grl-metadata-store.c @@ -26,6 +26,7 @@ #include <glib.h> #include <glib/gstdio.h> +#include <glib/gi18n-lib.h> #include <grilo.h> #include <sqlite3.h> #include <string.h> @@ -43,8 +44,8 @@ GRL_LOG_DOMAIN_STATIC(metadata_store_log_domain); #define PLUGIN_ID METADATA_STORE_PLUGIN_ID #define SOURCE_ID "grl-metadata-store" -#define SOURCE_NAME "Metadata Store" -#define SOURCE_DESC "A plugin for storing extra metadata information" +#define SOURCE_NAME _("Metadata Store") +#define SOURCE_DESC _("A plugin for storing extra metadata information") #define GRL_SQL_DB "grl-metadata-store.db" @@ -158,6 +159,10 @@ grl_metadata_store_source_plugin_init (GrlRegistry *registry, GRL_DEBUG ("grl_metadata_store_source_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + GrlMetadataStoreSource *source = grl_metadata_store_source_new (); grl_registry_register_source (registry, plugin, @@ -563,8 +568,8 @@ write_keys (sqlite3 *db, "keys is writable"); *error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_STORE_METADATA_FAILED, - "Failed to update metadata, " - "specified keys are not writable"); + _("Failed to update metadata: %s"), + _("specified keys are not writable")); goto done; } @@ -582,7 +587,8 @@ write_keys (sqlite3 *db, failed_keys = g_list_copy (sms->keys); *error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_STORE_METADATA_FAILED, - "Failed to update metadata"); + _("Failed to update metadata: %s"), + sqlite3_errmsg (db)); goto done; } @@ -601,9 +607,9 @@ write_keys (sqlite3 *db, source_id, media_id, sqlite3_errmsg (db)); g_list_free (failed_keys); failed_keys = g_list_copy (sms->keys); - *error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_STORE_METADATA_FAILED, - "Failed to update metadata"); + *error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_STORE_METADATA_FAILED, + _("Failed to update metadata")); goto done; } @@ -746,8 +752,9 @@ grl_metadata_store_source_resolve (GrlSource *source, if (!source_id) { GRL_WARNING ("Failed to resolve metadata: source-id not available"); error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_RESOLVE_FAILED, - "source-id not available, cannot resolve metadata."); + GRL_CORE_ERROR_RESOLVE_FAILED, + _("Failed to resolve: %s"), + _("\"source-id\" not available")); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); return; @@ -765,9 +772,9 @@ grl_metadata_store_source_resolve (GrlSource *source, rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL); } else { GRL_WARNING ("Failed to resolve metadata"); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_RESOLVE_FAILED, - "Failed to resolve metadata."); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("Failed to resolve")); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); } @@ -791,7 +798,8 @@ grl_metadata_store_source_store_metadata (GrlSource *source, GRL_WARNING ("Failed to update metadata: source-id not available"); error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_STORE_METADATA_FAILED, - "source-id not available, cannot update metadata."); + _("Failed to update metadata: %s"), + _("\"source-id\" not available")); failed_keys = g_list_copy (sms->keys); } else { /* Special case for root categories */ @@ -832,9 +840,9 @@ grl_metadata_store_source_search (GrlSource *source, db = GRL_METADATA_STORE_SOURCE (source)->priv->db; if (!db) { GRL_WARNING ("Can't execute operation: no database connection."); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_QUERY_FAILED, - "No database connection"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_QUERY_FAILED, + _("No database connection")); ss->callback (ss->source, ss->operation_id, NULL, 0, ss->user_data, error); g_error_free (error); return; @@ -877,7 +885,8 @@ grl_metadata_store_source_search (GrlSource *source, GRL_WARNING ("Failed to search in the metadata store: %s", sqlite3_errmsg (db)); error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_SEARCH_FAILED, - "Failed to search in the metadata store"); + _("Failed to search: %s"), + sqlite3_errmsg (db)); ss->callback (ss->source, ss->operation_id, NULL, 0, ss->user_data, error); g_error_free (error); return; @@ -907,7 +916,8 @@ grl_metadata_store_source_search (GrlSource *source, GRL_WARNING ("Failed to search in the metadata store: %s", sqlite3_errmsg (db)); error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_SEARCH_FAILED, - "Failed to search in the metadata store"); + _("Failed to search: %s"), + sqlite3_errmsg (db)); ss->callback (ss->source, ss->operation_id, NULL, 0, ss->user_data, error); g_error_free (error); sqlite3_finalize (sql_stmt); diff --git a/src/optical-media/Makefile.am b/src/optical-media/Makefile.am index 0877aa4..5c5a39d 100644 --- a/src/optical-media/Makefile.am +++ b/src/optical-media/Makefile.am @@ -7,8 +7,9 @@ ext_LTLIBRARIES = libgrloptical-media.la -libgrloptical_media_la_CFLAGS = \ - $(DEPS_OPTICAL_MEDIA_STORE_CFLAGS) +libgrloptical_media_la_CFLAGS = \ + $(DEPS_OPTICAL_MEDIA_STORE_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrloptical_media_la_LIBADD = \ $(DEPS_OPTICAL_MEDIA_STORE_LIBS) diff --git a/src/optical-media/grl-optical-media.c b/src/optical-media/grl-optical-media.c index 0b7c47a..8696882 100644 --- a/src/optical-media/grl-optical-media.c +++ b/src/optical-media/grl-optical-media.c @@ -26,6 +26,7 @@ #include <grilo.h> #include <gio/gio.h> +#include <glib/gi18n-lib.h> #include <totem-pl-parser.h> #include <string.h> #include <stdlib.h> @@ -42,8 +43,8 @@ GRL_LOG_DOMAIN_STATIC(optical_media_log_domain); #define PLUGIN_ID OPTICAL_MEDIA_PLUGIN_ID #define SOURCE_ID "grl-optical-media" -#define SOURCE_NAME "Optical Media" -#define SOURCE_DESC "A source for browsing optical media" +#define SOURCE_NAME _("Optical Media") +#define SOURCE_DESC _("A source for browsing optical media") /* --- Grilo OpticalMedia Private --- */ @@ -93,6 +94,10 @@ grl_optical_media_plugin_init (GrlRegistry *registry, GRL_DEBUG ("%s", __FUNCTION__); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + GrlOpticalMediaSource *source = grl_optical_media_source_new (); grl_registry_register_source (registry, diff --git a/src/podcasts/Makefile.am b/src/podcasts/Makefile.am index 4e5a357..31d81ac 100644 --- a/src/podcasts/Makefile.am +++ b/src/podcasts/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrlpodcasts.la libgrlpodcasts_la_CFLAGS = \ - $(DEPS_PODCASTS_CFLAGS) + $(DEPS_PODCASTS_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlpodcasts_la_LIBADD = \ $(DEPS_PODCASTS_LIBS) diff --git a/src/podcasts/grl-podcasts.c b/src/podcasts/grl-podcasts.c index 191ae8e..9c7c338 100644 --- a/src/podcasts/grl-podcasts.c +++ b/src/podcasts/grl-podcasts.c @@ -26,6 +26,7 @@ #include <glib.h> #include <glib/gstdio.h> +#include <glib/gi18n-lib.h> #include <grilo.h> #include <net/grl-net.h> #include <libxml/xpath.h> @@ -151,7 +152,7 @@ GRL_LOG_DOMAIN_STATIC(podcasts_log_domain); #define SOURCE_ID "grl-podcasts" #define SOURCE_NAME "Podcasts" -#define SOURCE_DESC "A source for browsing podcasts" +#define SOURCE_DESC _("A source for browsing podcasts") enum { PODCAST_ID = 0, @@ -276,6 +277,10 @@ grl_podcasts_plugin_init (GrlRegistry *registry, GRL_DEBUG ("podcasts_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + GrlPodcastsSource *source = grl_podcasts_source_new (); grl_registry_register_source (registry, plugin, @@ -740,8 +745,9 @@ produce_podcast_contents_from_db (OperationSpec *os) if (r != SQLITE_OK) { GRL_WARNING ("Failed to retrieve podcast streams: %s", sqlite3_errmsg (db)); error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to retrieve podcast streams"); + os->error_code, + _("Failed to get podcast streams: %s"), + sqlite3_errmsg (db)); os->callback (os->source, os->operation_id, NULL, 0, os->user_data, error); g_error_free (error); return; @@ -759,8 +765,9 @@ produce_podcast_contents_from_db (OperationSpec *os) if (r != SQLITE_DONE) { GRL_WARNING ("Failed to retrive podcast streams: %s", sqlite3_errmsg (db)); error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to retrieve podcast streams"); + os->error_code, + _("Failed to get podcast streams: %s"), + sqlite3_errmsg (db)); os->callback (os->source, os->operation_id, NULL, 0, os->user_data, error); g_error_free (error); sqlite3_finalize (sql_stmt); @@ -802,8 +809,9 @@ remove_podcast_streams (sqlite3 *db, const gchar *podcast_id, GError **error) if (r) { GRL_WARNING ("Failed to remove podcast streams cache: %s", sql_error); *error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_REMOVE_FAILED, - "Failed to remove podcast streams"); + GRL_CORE_ERROR_REMOVE_FAILED, + _("Failed to remove: %s"), + sql_error); sqlite3_free (error); } } @@ -831,10 +839,11 @@ remove_podcast (GrlPodcastsSource *podcasts_source, if (r != SQLITE_OK) { GRL_WARNING ("Failed to remove podcast '%s': %s", podcast_id, sql_error); - g_set_error_literal (error, - GRL_CORE_ERROR, - GRL_CORE_ERROR_REMOVE_FAILED, - "Failed to remove podcast"); + g_set_error (error, + GRL_CORE_ERROR, + GRL_CORE_ERROR_REMOVE_FAILED, + _("Failed to remove: %s"), + sql_error); sqlite3_free (sql_error); } else if (podcasts_source->priv->notify_changes) { grl_source_notify_change (GRL_SOURCE (podcasts_source), @@ -862,10 +871,11 @@ remove_stream (GrlPodcastsSource *podcasts_source, if (r != SQLITE_OK) { GRL_WARNING ("Failed to remove podcast stream '%s': %s", url, sql_error); - g_set_error_literal (error, - GRL_CORE_ERROR, - GRL_CORE_ERROR_REMOVE_FAILED, - "Failed to remove podcast stream"); + g_set_error (error, + GRL_CORE_ERROR, + GRL_CORE_ERROR_REMOVE_FAILED, + _("Failed to remove: %s"), + sql_error); sqlite3_free (sql_error); } else if (podcasts_source->priv->notify_changes) { grl_source_notify_change (GRL_SOURCE (podcasts_source), @@ -905,7 +915,8 @@ store_podcast (GrlPodcastsSource *podcasts_source, g_set_error (error, GRL_CORE_ERROR, GRL_CORE_ERROR_STORE_FAILED, - "Failed to store podcast '%s'", title); + _("Failed to store: %s"), + sqlite3_errmsg (podcasts_source->priv->db)); return; } @@ -937,7 +948,8 @@ store_podcast (GrlPodcastsSource *podcasts_source, g_set_error (error, GRL_CORE_ERROR, GRL_CORE_ERROR_STORE_FAILED, - "Failed to store podcast '%s'", title); + _("Failed to store: %s"), + sqlite3_errmsg (podcasts_source->priv->db)); sqlite3_finalize (sql_stmt); return; } @@ -1218,18 +1230,18 @@ parse_feed (OperationSpec *os, const gchar *str, GError **error) doc = xmlParseDoc ((xmlChar *) str); if (!doc) { - *error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to parse podcast contents"); + *error = g_error_new_literal (GRL_CORE_ERROR, + os->error_code, + _("Failed to parse content")); goto free_resources; } /* Get feed stream list */ xpathCtx = xmlXPathNewContext (doc); if (!xpathCtx) { - *error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to parse podcast contents"); + *error = g_error_new_literal (GRL_CORE_ERROR, + os->error_code, + _("Failed to parse content")); goto free_resources; } @@ -1237,9 +1249,9 @@ parse_feed (OperationSpec *os, const gchar *str, GError **error) xpathObj = xmlXPathEvalExpression ((xmlChar *) "/rss/channel", xpathCtx); if(xpathObj == NULL) { - *error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to parse podcast contents"); + *error = g_error_new_literal (GRL_CORE_ERROR, + os->error_code, + _("Failed to parse content")); goto free_resources; } @@ -1270,9 +1282,9 @@ parse_feed (OperationSpec *os, const gchar *str, GError **error) xpathObj = xmlXPathEvalExpression ((xmlChar *) "/rss/channel/item", xpathCtx); if(xpathObj == NULL) { - *error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to parse podcast contents"); + *error = g_error_new_literal (GRL_CORE_ERROR, + os->error_code, + _("Failed to parse podcast contents")); goto free_resources; } @@ -1339,9 +1351,9 @@ read_feed_cb (gchar *xmldata, gpointer user_data) OperationSpec *os = (OperationSpec *) user_data; if (!xmldata) { - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_BROWSE_FAILED, - "Failed to read data from podcast"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_BROWSE_FAILED, + _("Empty response")); } else { parse_feed (os, xmldata, &error); } @@ -1428,9 +1440,9 @@ produce_podcast_contents (OperationSpec *os) } sqlite3_finalize (sql_stmt); } else { - error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to retrieve podcast information"); + error = g_error_new_literal (GRL_CORE_ERROR, + os->error_code, + _("Failed to get podcast information")); os->callback (os->source, os->operation_id, NULL, 0, os->user_data, error); g_error_free (error); g_slice_free (OperationSpec, os); @@ -1469,8 +1481,9 @@ produce_podcasts (OperationSpec *os) if (r != SQLITE_OK) { GRL_WARNING ("Failed to retrieve podcasts: %s", sqlite3_errmsg (db)); error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to retrieve podcasts list"); + os->error_code, + _("Failed to get podcasts list: %s"), + sqlite3_errmsg (db)); os->callback (os->source, os->operation_id, NULL, 0, os->user_data, error); g_error_free (error); goto free_resources; @@ -1488,8 +1501,9 @@ produce_podcasts (OperationSpec *os) if (r != SQLITE_DONE) { GRL_WARNING ("Failed to retrieve podcasts: %s", sqlite3_errmsg (db)); error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to retrieve podcasts list"); + os->error_code, + _("Failed to get podcasts list: %s"), + sqlite3_errmsg (db)); os->callback (os->source, os->operation_id, NULL, 0, os->user_data, error); g_error_free (error); goto free_resources; @@ -1540,9 +1554,9 @@ stream_resolve (GrlSourceResolveSpec *rs) if (r != SQLITE_OK) { GRL_WARNING ("Failed to get podcast stream: %s", sqlite3_errmsg (db)); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_RESOLVE_FAILED, - "Failed to get podcast stream metadata"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("Failed to get podcast stream metadata")); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); return; @@ -1555,9 +1569,9 @@ stream_resolve (GrlSourceResolveSpec *rs) rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, NULL); } else { GRL_WARNING ("Failed to get podcast stream: %s", sqlite3_errmsg (db)); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_RESOLVE_FAILED, - "Failed to get podcast stream metadata"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("Failed to get podcast stream metadata")); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); } @@ -1593,9 +1607,9 @@ podcast_resolve (GrlSourceResolveSpec *rs) sqlite3_finalize (sql_stmt); } else { GRL_WARNING ("Failed to get podcast: %s", sqlite3_errmsg (db)); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_RESOLVE_FAILED, - "Failed to get podcast metadata"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("Failed to get podcast metadata")); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); } @@ -1637,9 +1651,9 @@ grl_podcasts_source_browse (GrlSource *source, podcasts_source = GRL_PODCASTS_SOURCE (source); if (!podcasts_source->priv->db) { GRL_WARNING ("Can't execute operation: no database connection."); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_BROWSE_FAILED, - "No database connection"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_BROWSE_FAILED, + _("No database connection")); bs->callback (bs->source, bs->operation_id, NULL, 0, bs->user_data, error); g_error_free (error); return; @@ -1681,9 +1695,9 @@ grl_podcasts_source_search (GrlSource *source, podcasts_source = GRL_PODCASTS_SOURCE (source); if (!podcasts_source->priv->db) { GRL_WARNING ("Can't execute operation: no database connection."); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_QUERY_FAILED, - "No database connection"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_QUERY_FAILED, + _("No database connection")); ss->callback (ss->source, ss->operation_id, NULL, 0, ss->user_data, error); g_error_free (error); return; @@ -1715,9 +1729,9 @@ grl_podcasts_source_query (GrlSource *source, GrlSourceQuerySpec *qs) podcasts_source = GRL_PODCASTS_SOURCE (source); if (!podcasts_source->priv->db) { GRL_WARNING ("Can't execute operation: no database connection."); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_QUERY_FAILED, - "No database connection"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_QUERY_FAILED, + _("No database connection")); qs->callback (qs->source, qs->operation_id, NULL, 0, qs->user_data, error); g_error_free (error); return; @@ -1750,9 +1764,9 @@ grl_podcasts_source_resolve (GrlSource *source, podcasts_source = GRL_PODCASTS_SOURCE (source); if (!podcasts_source->priv->db) { GRL_WARNING ("Can't execute operation: no database connection."); - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_RESOLVE_FAILED, - "No database connection"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("No database connection")); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); return; @@ -1777,13 +1791,14 @@ grl_podcasts_source_store (GrlSource *source, GrlSourceStoreSpec *ss) keylist = grl_data_get_keys (GRL_DATA (ss->media)); if (GRL_IS_MEDIA_BOX (ss->media)) { - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_STORE_FAILED, - "Cannot create containers. Only feeds are accepted."); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_STORE_FAILED, + _("Cannot create containers. Only feeds are accepted")); } else if (!grl_data_has_key (GRL_DATA (ss->media), GRL_METADATA_KEY_URL)) { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_STORE_FAILED, - "Cannot store podcast. URL required"); + _("Failed to store: %s"), + _("URL required")); } else { store_podcast (GRL_PODCASTS_SOURCE (ss->source), &keylist, diff --git a/src/raitv/Makefile.am b/src/raitv/Makefile.am index 70a975f..ea6fbd9 100644 --- a/src/raitv/Makefile.am +++ b/src/raitv/Makefile.am @@ -7,7 +7,8 @@ ext_LTLIBRARIES = libgrlraitv.la libgrlraitv_la_CFLAGS = \ - $(DEPS_RAITV_CFLAGS) + $(DEPS_RAITV_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlraitv_la_LIBADD = \ $(DEPS_RAITV_LIBS) diff --git a/src/raitv/grl-raitv.c b/src/raitv/grl-raitv.c index d04d27c..6add57f 100644 --- a/src/raitv/grl-raitv.c +++ b/src/raitv/grl-raitv.c @@ -29,6 +29,7 @@ #include <libxml/HTMLparser.h> #include <string.h> #include <net/grl-net.h> +#include <glib/gi18n-lib.h> #include "grl-raitv.h" @@ -44,11 +45,11 @@ GRL_LOG_DOMAIN_STATIC(raitv_log_domain); #define ROOT_DIR_POPULARS_INDEX 0 #define ROOT_DIR_RECENTS_INDEX 1 -#define RAITV_POPULARS_ID "most-popular" -#define RAITV_POPULARS_NAME "Most Popular" +#define RAITV_POPULARS_ID "most-popular" +#define RAITV_POPULARS_NAME N_("Most Popular") #define RAITV_RECENTS_ID "recent" -#define RAITV_RECENTS_NAME "Recent" +#define RAITV_RECENTS_NAME N_("Recent") #define RAITV_POPULARS_THEME_ID "theme-popular" #define RAITV_RECENTS_THEME_ID "theme-recent" @@ -91,7 +92,7 @@ GRL_LOG_DOMAIN_STATIC(raitv_log_domain); #define SOURCE_ID "grl-raitv" #define SOURCE_NAME "Rai.tv" -#define SOURCE_DESC "A source for browsing and searching Rai.tv videos" +#define SOURCE_DESC _("A source for browsing and searching Rai.tv videos") G_DEFINE_TYPE (GrlRaitvSource, grl_raitv_source, GRL_TYPE_SOURCE) @@ -169,29 +170,29 @@ CategoryInfo root_dir[] = { }; CategoryInfo themes_dir[] = { - {"all","All",-1,"","Tematica:News^Tematica:ntz"}, - {"bianco_nero","Bianco e Nero",-1,"Tematica:Bianco e Nero",""}, - {"cinema","Cinema",-1,"Tematica:Cinema",""}, - {"comici","Comici",-1,"Tematica:Comici",""}, - {"cronaca","Cronaca",-1,"Tematica:Cronaca",""}, - {"cultura","Cultura",-1,"Tematica:Cultura",""}, - {"economia","Economia",-1,"Tematica:Economia",""}, - {"fiction","Fiction",-1,"Tematica:Fiction",""}, - {"junior","Junior",-1,"Tematica:Junior",""}, - {"inchieste","Inchieste",-1,"Tematica:Inchieste",""}, - {"interviste","Interviste",-1,"Tematica:Interviste",""}, - {"musica","Musica",-1,"Tematica:Musica",""}, - {"news","News",-1,"Tematica:News",""}, - {"salute","Salute",-1,"Tematica:Salute",""}, - {"satira","Satira",-1,"Tematica:Satira",""}, - {"scienza","Scienza",-1,"Tematica:Scienza",""}, - {"societa","Societa",-1,"Tematica:Societa",""}, - {"spettacolo","Spettacolo",-1,"Tematica:Spettacolo",""}, - {"sport","Sport",-1,"Tematica:Sport",""}, - {"storia","Storia",-1,"Tematica:Storia",""}, - {"politica","Politica",-1,"Tematica:Politica",""}, - {"tempo_libero","Tempo libero",-1,"Tematica:Tempo libero",""}, - {"viaggi","Viaggi",-1,"Tematica:Viaggi",""}, + {"all",N_("All"),-1,"","Tematica:News^Tematica:ntz"}, + {"bianco_nero",N_("Back and White"),-1,"Tematica:Bianco e Nero",""}, + {"cinema",N_("Cinema"),-1,"Tematica:Cinema",""}, + {"comici",N_("Comedians"),-1,"Tematica:Comici",""}, + {"cronaca",N_("Chronicle"),-1,"Tematica:Cronaca",""}, + {"cultura",N_("Culture"),-1,"Tematica:Cultura",""}, + {"economia",N_("Economy"),-1,"Tematica:Economia",""}, + {"fiction",N_("Fiction"),-1,"Tematica:Fiction",""}, + {"junior",N_("Junior"),-1,"Tematica:Junior",""}, + {"inchieste",N_("Investigations"),-1,"Tematica:Inchieste",""}, + {"interviste",N_("Interviews"),-1,"Tematica:Interviste",""}, + {"musica",N_("Music"),-1,"Tematica:Musica",""}, + {"news",N_("News"),-1,"Tematica:News",""}, + {"salute",N_("Health"),-1,"Tematica:Salute",""}, + {"satira",N_("Satire"),-1,"Tematica:Satira",""}, + {"scienza","Science",-1,"Tematica:Scienza",""}, + {"societa",N_("Society"),-1,"Tematica:Societa",""}, + {"spettacolo",N_("Show"),-1,"Tematica:Spettacolo",""}, + {"sport",N_("Sport"),-1,"Tematica:Sport",""}, + {"storia",N_("History"),-1,"Tematica:Storia",""}, + {"politica",N_("Politics"),-1,"Tematica:Politica",""}, + {"tempo_libero",N_("Leisure"),-1,"Tematica:Tempo libero",""}, + {"viaggi",N_("Travel"),-1,"Tematica:Viaggi",""}, {NULL, NULL, 0} }; @@ -236,6 +237,10 @@ grl_raitv_plugin_init (GrlRegistry *registry, { GRL_LOG_DOMAIN_INIT (raitv_log_domain, "raitv"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + GrlRaitvSource *source = grl_raitv_source_new (); grl_registry_register_source (registry, plugin, @@ -407,7 +412,7 @@ proxy_call_search_grlnet_async_cb (GObject *source_object, &wc_error)) { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_SEARCH_FAILED, - "Failed to search Rait.tv: '%s'", + _("Failed to search: %s"), wc_error->message); op->callback (op->source, @@ -604,7 +609,7 @@ proxy_call_browse_grlnet_async_cb (GObject *source_object, &wc_error)) { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_SEARCH_FAILED, - "Failed to browse Rait.tv: '%s'", + _("Failed to browse: %s"), wc_error->message); op->callback (op->source, @@ -858,7 +863,7 @@ proxy_call_resolve_grlnet_async_cb (GObject *source_object, &wc_error)) { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_SEARCH_FAILED, - "Failed to resolve Rait.tv: '%s'", + _("Failed to resolve: %s"), wc_error->message); op->resolveCb (op->source, @@ -1031,7 +1036,7 @@ produce_container_from_directory (GrlMedia *media, GRL_DEBUG ("MediaId=%s, Type:%d, Titolo:%s",mediaid, type, dir[index].name); grl_media_set_id (content, mediaid); - grl_media_set_title (content, dir[index].name); + grl_media_set_title (content, g_dgettext (GETTEXT_PACKAGE, dir[index].name)); g_free(mediaid); } diff --git a/src/shoutcast/Makefile.am b/src/shoutcast/Makefile.am index 9bc2950..d67148d 100644 --- a/src/shoutcast/Makefile.am +++ b/src/shoutcast/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrlshoutcast.la libgrlshoutcast_la_CFLAGS = \ - $(DEPS_SHOUTCAST_CFLAGS) + $(DEPS_SHOUTCAST_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlshoutcast_la_LIBADD = \ $(DEPS_SHOUTCAST_LIBS) diff --git a/src/shoutcast/grl-shoutcast.c b/src/shoutcast/grl-shoutcast.c index f8c9cfb..78b0386 100644 --- a/src/shoutcast/grl-shoutcast.c +++ b/src/shoutcast/grl-shoutcast.c @@ -28,6 +28,7 @@ #include <grilo.h> #include <net/grl-net.h> +#include <glib/gi18n-lib.h> #include <libxml/parser.h> #include <libxml/xpath.h> @@ -63,7 +64,7 @@ GRL_LOG_DOMAIN_STATIC(shoutcast_log_domain); #define SOURCE_ID "grl-shoutcast" #define SOURCE_NAME "SHOUTcast" -#define SOURCE_DESC "A source for browsing SHOUTcast radios" +#define SOURCE_DESC _("A source for browsing SHOUTcast radios") struct _GrlShoutcastSourcePriv { gchar *dev_key; @@ -134,6 +135,10 @@ grl_shoutcast_plugin_init (GrlRegistry *registry, GRL_DEBUG ("shoutcast_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + if (!configs) { GRL_INFO ("Configuration not provided! Plugin not loaded"); return FALSE; @@ -406,17 +411,17 @@ xml_parse_result (const gchar *str, OperationData *op_data) op_data->xml_doc = xmlReadMemory (str, xmlStrlen ((xmlChar*) str), NULL, NULL, XML_PARSE_RECOVER | XML_PARSE_NOBLANKS); if (!op_data->xml_doc) { - error = g_error_new (GRL_CORE_ERROR, - op_data->error_code, - "Failed to parse SHOUTcast's response"); + error = g_error_new_literal (GRL_CORE_ERROR, + op_data->error_code, + _("Failed to parse response")); goto finalize; } node = xmlDocGetRootElement (op_data->xml_doc); if (!node) { - error = g_error_new (GRL_CORE_ERROR, - op_data->error_code, - "Empty response from SHOUTcast"); + error = g_error_new_literal (GRL_CORE_ERROR, + op_data->error_code, + _("Empty response")); goto finalize; } @@ -454,7 +459,7 @@ xml_parse_result (const gchar *str, OperationData *op_data) } else { error = g_error_new (GRL_CORE_ERROR, op_data->error_code, - "Can not find media '%s'", + _("Cannot find media %s"), grl_media_get_id (op_data->media)); } if (xpath_res) { @@ -462,9 +467,9 @@ xml_parse_result (const gchar *str, OperationData *op_data) } xmlXPathFreeContext (xpath_ctx); } else { - error = g_error_new (GRL_CORE_ERROR, - op_data->error_code, - "Can not build xpath context"); + error = g_error_new_literal (GRL_CORE_ERROR, + op_data->error_code, + _("Failed to parse response")); } op_data->resolve_cb (op_data->source, @@ -557,7 +562,7 @@ read_done_cb (GObject *source_object, &wc_error)) { error = g_error_new (GRL_CORE_ERROR, op_data->error_code, - "Failed to connect SHOUTcast: '%s'", + _("Failed to connect: %s"), wc_error->message); op_data->result_cb (op_data->source, op_data->operation_id, @@ -750,8 +755,9 @@ grl_shoutcast_source_search (GrlSource *source, /* Check if there is text to search */ if (!ss->text || ss->text[0] == '\0') { error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_SEARCH_FAILED, - "Search text not specified"); + GRL_CORE_ERROR_SEARCH_NULL_UNSUPPORTED, + _("Failed to search: %s"), + _("non-NULL search text is required")); ss->callback (ss->source, ss->operation_id, NULL, diff --git a/src/tmdb/Makefile.am b/src/tmdb/Makefile.am index 6be3e0f..27d4b74 100644 --- a/src/tmdb/Makefile.am +++ b/src/tmdb/Makefile.am @@ -7,7 +7,9 @@ ext_LTLIBRARIES = libgrltmdb.la -libgrltmdb_la_CFLAGS = $(DEPS_TMDB_CFLAGS) +libgrltmdb_la_CFLAGS = \ + $(DEPS_TMDB_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrltmdb_la_LIBADD = $(DEPS_TMDB_LIBS) diff --git a/src/tmdb/grl-tmdb.c b/src/tmdb/grl-tmdb.c index 1065b1c..4c6b8d8 100644 --- a/src/tmdb/grl-tmdb.c +++ b/src/tmdb/grl-tmdb.c @@ -31,6 +31,7 @@ #include <net/grl-net.h> #include <libsoup/soup-uri.h> #include <json-glib/json-glib.h> +#include <glib/gi18n-lib.h> #include "grl-tmdb.h" #include "grl-tmdb-request.h" @@ -136,6 +137,10 @@ grl_tmdb_source_plugin_init (GrlRegistry *registry, GRL_DEBUG ("grl_tmdb_source_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + if (!configs) { GRL_INFO ("No configuration provided. Will not load plugin"); return FALSE; @@ -940,7 +945,7 @@ on_search_ready (GObject *source, /* Cannot continue without id */ error = g_error_new_literal (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "Remote data did not contain valid ID"); + _("Remote data does not contain valid identifier")); resolve_closure_callback (closure, error); resolve_closure_free (closure); g_error_free (error); diff --git a/src/tracker/Makefile.am b/src/tracker/Makefile.am index 6d863a2..2e9a7ae 100644 --- a/src/tracker/Makefile.am +++ b/src/tracker/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrltracker.la libgrltracker_la_CFLAGS = \ - $(DEPS_TRACKER_CFLAGS) + $(DEPS_TRACKER_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrltracker_la_LIBADD = \ $(DEPS_TRACKER_LIBS) diff --git a/src/tracker/grl-tracker-source-api.c b/src/tracker/grl-tracker-source-api.c index 6c35331..c00d52b 100644 --- a/src/tracker/grl-tracker-source-api.c +++ b/src/tracker/grl-tracker-source-api.c @@ -314,7 +314,7 @@ get_sparql_type_filter (GrlOperationOptions *options, \ error = g_error_new (GRL_CORE_ERROR, \ GRL_CORE_ERROR_BROWSE_FAILED, \ - "Failed to start query action : %s", \ + _("Failed to query: %s"), \ tracker_error->message); \ \ spec->callback (spec->source, \ @@ -396,7 +396,7 @@ get_sparql_type_filter (GrlOperationOptions *options, \ error = g_error_new (GRL_CORE_ERROR, \ GRL_CORE_ERROR_BROWSE_FAILED, \ - "Failed to start query action : %s", \ + _("Failed to query: %s"), \ tracker_error->message); \ \ spec->callback (spec->source, spec->operation_id, NULL, 0, \ @@ -442,7 +442,7 @@ tracker_resolve_cb (GObject *source_object, error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_BROWSE_FAILED, - "Failed to start resolve action : %s", + _("Failed to resolve: %s"), tracker_error->message); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); @@ -493,7 +493,7 @@ tracker_store_metadata_cb (GObject *source_object, error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_STORE_METADATA_FAILED, - "Failed to set metadata : %s", + _("Failed to update metadata: %s"), tracker_error->message); sms->callback (sms->source, sms->media, NULL, sms->user_data, error); @@ -610,7 +610,7 @@ grl_tracker_source_query (GrlSource *source, if (!qs->query || qs->query[0] == '\0') { error = g_error_new_literal (GRL_CORE_ERROR, GRL_CORE_ERROR_QUERY_FAILED, - "Empty query"); + _("Empty query")); goto send_error; } diff --git a/src/tracker/grl-tracker-source-priv.h b/src/tracker/grl-tracker-source-priv.h index 2af7ef9..c501232 100644 --- a/src/tracker/grl-tracker-source-priv.h +++ b/src/tracker/grl-tracker-source-priv.h @@ -30,15 +30,18 @@ #include "grl-tracker-source.h" #include "grl-tracker-source-cache.h" +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <glib/gi18n-lib.h> #include <tracker-sparql.h> /* ---- Source information ---- */ #define GRL_TRACKER_SOURCE_ID "grl-tracker-source" #define GRL_TRACKER_SOURCE_NAME "Tracker" -#define GRL_TRACKER_SOURCE_DESC \ - "A plugin for searching multimedia " \ - "content using Tracker" +#define GRL_TRACKER_SOURCE_DESC _("A plugin for searching multimedia content using Tracker") #define GRL_TRACKER_AUTHOR "Igalia S.L." #define GRL_TRACKER_LICENSE "LGPL" diff --git a/src/tracker/grl-tracker-utils.c b/src/tracker/grl-tracker-utils.c index 72213e0..e429f18 100644 --- a/src/tracker/grl-tracker-utils.c +++ b/src/tracker/grl-tracker-utils.c @@ -28,6 +28,7 @@ #endif #include "grl-tracker-utils.h" +#include <glib/gi18n-lib.h> /**/ @@ -602,7 +603,7 @@ get_tracker_volume_name (const gchar *uri, if (g_file_equal (m_file, file)) { gchar *m_name = g_mount_get_name (G_MOUNT (mount->data)); g_object_unref (G_OBJECT (m_file)); - source_name = g_strdup_printf ("Removable - %s", m_name); + source_name = g_strdup_printf (_("Removable - %s"), m_name); g_free (m_name); break; } @@ -614,7 +615,7 @@ get_tracker_volume_name (const gchar *uri, g_object_unref (G_OBJECT (file)); g_object_unref (G_OBJECT (volume_monitor)); } else { - source_name = g_strdup ("Local files"); + source_name = g_strdup (_("Local files")); } return source_name; diff --git a/src/tracker/grl-tracker.c b/src/tracker/grl-tracker.c index 478426f..10c1473 100644 --- a/src/tracker/grl-tracker.c +++ b/src/tracker/grl-tracker.c @@ -216,6 +216,11 @@ grl_tracker_plugin_init (GrlRegistry *registry, gint config_count; GRL_LOG_DOMAIN_INIT (tracker_general_log_domain, "tracker-general"); + + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + grl_tracker_source_init_notifs (); grl_tracker_source_init_requests (); diff --git a/src/upnp/Makefile.am b/src/upnp/Makefile.am index ac0d1b3..d7c821d 100644 --- a/src/upnp/Makefile.am +++ b/src/upnp/Makefile.am @@ -7,8 +7,9 @@ ext_LTLIBRARIES = libgrlupnp.la -libgrlupnp_la_CFLAGS = \ - $(DEPS_UPNP_CFLAGS) +libgrlupnp_la_CFLAGS = \ + $(DEPS_UPNP_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlupnp_la_LIBADD = \ $(DEPS_UPNP_LIBS) diff --git a/src/upnp/grl-upnp.c b/src/upnp/grl-upnp.c index 3b22df6..d433755 100644 --- a/src/upnp/grl-upnp.c +++ b/src/upnp/grl-upnp.c @@ -33,6 +33,7 @@ #include <string.h> #include <stdlib.h> #include <libxml/tree.h> +#include <glib/gi18n-lib.h> #include "grl-upnp.h" @@ -49,7 +50,7 @@ GRL_LOG_DOMAIN_STATIC(upnp_log_domain); #define PLUGIN_ID UPNP_PLUGIN_ID #define SOURCE_ID_TEMPLATE "grl-upnp-%s" -#define SOURCE_DESC_TEMPLATE "A source for browsing the UPnP server '%s'" +#define SOURCE_DESC_TEMPLATE _("A source for browsing the UPnP server '%s'") /* --- Other --- */ @@ -169,6 +170,10 @@ grl_upnp_plugin_init (GrlRegistry *registry, GRL_DEBUG ("grl_upnp_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + #if !GLIB_CHECK_VERSION(2,32,0) /* libsoup needs this */ if (!g_thread_supported()) { @@ -1244,9 +1249,9 @@ grl_upnp_source_browse (GrlSource *source, } if (!action) { - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_BROWSE_FAILED, - "Failed to start browse action"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_BROWSE_FAILED, + _("Failed to browse")); bs->callback (bs->source, bs->operation_id, NULL, 0, bs->user_data, error); g_error_free (error); g_slice_free (struct OperationSpec, os); @@ -1301,9 +1306,9 @@ grl_upnp_source_search (GrlSource *source, GrlSourceSearchSpec *ss) "", NULL); if (!action) { - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_SEARCH_FAILED, - "Failed to start browse action"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_SEARCH_FAILED, + _("Failed to browse")); ss->callback (ss->source, ss->operation_id, NULL, 0, ss->user_data, error); g_error_free (error); g_slice_free (struct OperationSpec, os); @@ -1364,9 +1369,9 @@ grl_upnp_source_query (GrlSource *source, GrlSourceQuerySpec *qs) "", NULL); if (!action) { - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_QUERY_FAILED, - "Failed to start query action"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_QUERY_FAILED, + _("Failed to query")); qs->callback (qs->source, qs->operation_id, NULL, 0, qs->user_data, error); g_error_free (error); g_slice_free (struct OperationSpec, os); @@ -1414,9 +1419,9 @@ grl_upnp_source_resolve (GrlSource *source, "", NULL); if (!action) { - error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_RESOLVE_FAILED, - "Failed to start resolve action"); + error = g_error_new_literal (GRL_CORE_ERROR, + GRL_CORE_ERROR_RESOLVE_FAILED, + _("Failed to resolve")); rs->callback (rs->source, rs->operation_id, rs->media, rs->user_data, error); g_error_free (error); } @@ -1485,7 +1490,7 @@ grl_upnp_source_notify_change_start (GrlSource *source, g_set_error (error, GRL_CORE_ERROR, GRL_CORE_ERROR_NOTIFY_CHANGED_FAILED, - "Unable to listen for changes in %s", + _("Unable to listen for changes in %s"), grl_source_get_id (GRL_SOURCE (source))); return FALSE; } diff --git a/src/vimeo/Makefile.am b/src/vimeo/Makefile.am index bf85da9..0250ac9 100644 --- a/src/vimeo/Makefile.am +++ b/src/vimeo/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrlvimeo.la libgrlvimeo_la_CFLAGS = \ - $(DEPS_VIMEO_CFLAGS) + $(DEPS_VIMEO_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlvimeo_la_LIBADD = \ $(DEPS_VIMEO_LIBS) diff --git a/src/vimeo/grl-vimeo.c b/src/vimeo/grl-vimeo.c index a9f02ac..8961d37 100644 --- a/src/vimeo/grl-vimeo.c +++ b/src/vimeo/grl-vimeo.c @@ -33,6 +33,7 @@ #include <stdlib.h> #include <stdio.h> #include <errno.h> +#include <glib/gi18n-lib.h> #include "grl-vimeo.h" #include "gvimeo.h" @@ -53,7 +54,7 @@ GRL_LOG_DOMAIN_STATIC(vimeo_log_domain); #define SOURCE_ID "grl-vimeo" #define SOURCE_NAME "Vimeo" -#define SOURCE_DESC "A source for browsing and searching Vimeo videos" +#define SOURCE_DESC _("A source for browsing and searching Vimeo videos") #define MAX_ELEMENTS 50 @@ -112,6 +113,10 @@ grl_vimeo_plugin_init (GrlRegistry *registry, GRL_DEBUG ("vimeo_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + #if !GLIB_CHECK_VERSION(2,32,0) if (!g_thread_supported ()) { g_thread_init (NULL); @@ -501,10 +506,10 @@ grl_vimeo_source_search (GrlSource *source, if (!ss->text) { /* Vimeo does not support searching all */ - error = - g_error_new_literal (GRL_CORE_ERROR, - GRL_CORE_ERROR_SEARCH_NULL_UNSUPPORTED, - "Unable to execute search: non NULL search text is required"); + error = g_error_new (GRL_CORE_ERROR, + GRL_CORE_ERROR_SEARCH_NULL_UNSUPPORTED, + _("Failed to search: %s"), + _("non-NULL search text is required")); ss->callback (ss->source, ss->operation_id, NULL, 0, ss->user_data, error); g_error_free (error); return; diff --git a/src/youtube/Makefile.am b/src/youtube/Makefile.am index 254a139..4418669 100644 --- a/src/youtube/Makefile.am +++ b/src/youtube/Makefile.am @@ -8,7 +8,8 @@ ext_LTLIBRARIES = libgrlyoutube.la libgrlyoutube_la_CFLAGS = \ - $(DEPS_YOUTUBE_CFLAGS) + $(DEPS_YOUTUBE_CFLAGS) \ + -DLOCALEDIR=\"$(localedir)\" libgrlyoutube_la_LIBADD = \ $(DEPS_YOUTUBE_LIBS) diff --git a/src/youtube/grl-youtube.c b/src/youtube/grl-youtube.c index 0e6d45f..5b81bbf 100644 --- a/src/youtube/grl-youtube.c +++ b/src/youtube/grl-youtube.c @@ -26,6 +26,7 @@ #endif #include <grilo.h> +#include <glib/gi18n-lib.h> #include <net/grl-net.h> #include <gdata/gdata.h> #include <quvi/quvi.h> @@ -56,43 +57,43 @@ GRL_LOG_DOMAIN_STATIC(youtube_log_domain); #define ROOT_DIR_CATEGORIES_INDEX 1 #define YOUTUBE_FEEDS_ID "standard-feeds" -#define YOUTUBE_FEEDS_NAME "Standard feeds" +#define YOUTUBE_FEEDS_NAME N_("Standard feeds") #define YOUTUBE_CATEGORIES_ID "categories" -#define YOUTUBE_CATEGORIES_NAME "Categories" +#define YOUTUBE_CATEGORIES_NAME N_("Categories") #define YOUTUBE_CATEGORIES_URL "http://gdata.youtube.com/schemas/2007/categories.cat" /* ----- Feeds categories ---- */ #define YOUTUBE_TOP_RATED_ID (YOUTUBE_FEEDS_ID "/0") -#define YOUTUBE_TOP_RATED_NAME "Top Rated" +#define YOUTUBE_TOP_RATED_NAME N_("Top Rated") #define YOUTUBE_TOP_FAVS_ID (YOUTUBE_FEEDS_ID "/1") -#define YOUTUBE_TOP_FAVS_NAME "Top Favorites" +#define YOUTUBE_TOP_FAVS_NAME N_("Top Favorites") #define YOUTUBE_MOST_VIEWED_ID (YOUTUBE_FEEDS_ID "/2") -#define YOUTUBE_MOST_VIEWED_NAME "Most Viewed" +#define YOUTUBE_MOST_VIEWED_NAME N_("Most Viewed") #define YOUTUBE_MOST_POPULAR_ID (YOUTUBE_FEEDS_ID "/3") -#define YOUTUBE_MOST_POPULAR_NAME "Most Popular" +#define YOUTUBE_MOST_POPULAR_NAME N_("Most Popular") #define YOUTUBE_MOST_RECENT_ID (YOUTUBE_FEEDS_ID "/4") -#define YOUTUBE_MOST_RECENT_NAME "Most Recent" +#define YOUTUBE_MOST_RECENT_NAME N_("Most Recent") #define YOUTUBE_MOST_DISCUSSED_ID (YOUTUBE_FEEDS_ID "/5") -#define YOUTUBE_MOST_DISCUSSED_NAME "Most Discussed" +#define YOUTUBE_MOST_DISCUSSED_NAME N_("Most Discussed") #define YOUTUBE_MOST_LINKED_ID (YOUTUBE_FEEDS_ID "/6") -#define YOUTUBE_MOST_LINKED_NAME "Most Linked" +#define YOUTUBE_MOST_LINKED_NAME N_("Most Linked") #define YOUTUBE_MOST_RESPONDED_ID (YOUTUBE_FEEDS_ID "/7") -#define YOUTUBE_MOST_RESPONDED_NAME "Most Responded" +#define YOUTUBE_MOST_RESPONDED_NAME N_("Most Responded") #define YOUTUBE_FEATURED_ID (YOUTUBE_FEEDS_ID "/8") -#define YOUTUBE_FEATURED_NAME "Recently Featured" +#define YOUTUBE_FEATURED_NAME N_("Recently Featured") #define YOUTUBE_MOBILE_ID (YOUTUBE_FEEDS_ID "/9") -#define YOUTUBE_MOBILE_NAME "Watch On Mobile" +#define YOUTUBE_MOBILE_NAME N_("Watch On Mobile") /* --- Other --- */ @@ -113,7 +114,7 @@ GRL_LOG_DOMAIN_STATIC(youtube_log_domain); #define SOURCE_ID "grl-youtube" #define SOURCE_NAME "YouTube" -#define SOURCE_DESC "A source for browsing and searching YouTube videos" +#define SOURCE_DESC _("A source for browsing and searching YouTube videos") /* --- Data types --- */ @@ -263,6 +264,10 @@ grl_youtube_plugin_init (GrlRegistry *registry, GRL_DEBUG ("youtube_plugin_init"); + /* Initialize i18n */ + bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + if (!configs) { GRL_INFO ("Configuration not provided! Plugin not loaded"); return FALSE; @@ -666,7 +671,8 @@ parse_categories (xmlDocPtr doc, xmlNodePtr node, BuildCategorySpec *bcs) do { cat_info = (CategoryInfo *) iter->data; categories_dir[total - 1].id = cat_info->id ; - categories_dir[total - 1].name = cat_info->name; + categories_dir[total - 1].name = (gchar *) g_dgettext (GETTEXT_PACKAGE, + cat_info->name); categories_dir[total - 1].count = -1; total--; g_slice_free (CategoryInfo, cat_info); @@ -937,9 +943,9 @@ search_cb (GObject *object, GAsyncResult *result, OperationSpec *os) } } else { if (!error) { - error = g_error_new (GRL_CORE_ERROR, - os->error_code, - "Failed to obtain feed from YouTube"); + error = g_error_new_literal (GRL_CORE_ERROR, + os->error_code, + _("Failed to get feed")); } else { error->code = os->error_code; } @@ -1053,7 +1059,7 @@ produce_container_from_directory (GDataService *service, grl_media_set_title (content, YOUTUBE_ROOT_NAME); } else { grl_media_set_id (content, dir[index].id); - grl_media_set_title (content, dir[index].name); + grl_media_set_title (content, g_dgettext (GETTEXT_PACKAGE, dir[index].name)); } grl_media_set_site (content, YOUTUBE_SITE_URL); set_category_childcount (service, GRL_MEDIA_BOX (content), dir, index); @@ -1119,8 +1125,9 @@ produce_from_feed (OperationSpec *os) if (feed_type < 0) { error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_BROWSE_FAILED, - "Invalid feed id: %s", os->container_id); + GRL_CORE_ERROR_BROWSE_FAILED, + _("Invalid feed identifier %s"), + os->container_id); os->callback (os->source, os->operation_id, NULL, @@ -1189,8 +1196,9 @@ produce_from_category (OperationSpec *os) if (!category_term) { error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_BROWSE_FAILED, - "Invalid category id: %s", os->container_id); + GRL_CORE_ERROR_BROWSE_FAILED, + _("Invalid category identifier %s"), + os->container_id); os->callback (os->source, os->operation_id, NULL, @@ -1330,7 +1338,8 @@ produce_container_from_category_cb (BuildCategorySpec *spec) media = rs->media; error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "Invalid category id"); + _("Invalid category identifier %s"), + id); } rs->callback (rs->source, rs->operation_id, media, rs->user_data, error); @@ -1524,7 +1533,8 @@ grl_youtube_source_resolve (GrlSource *source, } else { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "Invalid feed id"); + _("Invalid feed identifier %s"), + id); } } break; @@ -1543,7 +1553,8 @@ grl_youtube_source_resolve (GrlSource *source, } else { error = g_error_new (GRL_CORE_ERROR, GRL_CORE_ERROR_RESOLVE_FAILED, - "Invalid category id"); + _("Invalid category identifier %s"), + id); } } } @@ -1614,8 +1625,9 @@ grl_youtube_get_media_from_uri (GrlSource *source, video_id = get_video_id_from_url (mfus->uri); if (video_id == NULL) { error = g_error_new (GRL_CORE_ERROR, - GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED, - "Cannot create media from '%s'", mfus->uri); + GRL_CORE_ERROR_MEDIA_FROM_URI_FAILED, + _("Cannot get media from %s"), + mfus->uri); mfus->callback (source, mfus->operation_id, NULL, mfus->user_data, error); g_error_free (error); return; |