[libgovirt] Translate all user visible strings
- From: Fabiano Fidêncio <ffidencio src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgovirt] Translate all user visible strings
- Date: Mon, 15 Sep 2014 12:44:26 +0000 (UTC)
commit 43fe5ef3d034038d737e696fad21320443a79dc9
Author: Fabiano Fidêncio <fidencio redhat com>
Date: Mon Sep 15 13:50:42 2014 +0200
Translate all user visible strings
g_warning(), g_message() and family are not being translated and
capitalization of a few strings were fixed at the same time.
govirt/ovirt-action-rest-call.c | 4 +++-
govirt/ovirt-collection.c | 4 +++-
govirt/ovirt-options.c | 8 +++++---
govirt/ovirt-proxy.c | 8 +++++---
govirt/ovirt-resource-rest-call.c | 3 ++-
govirt/ovirt-resource.c | 25 ++++++++++++++++---------
govirt/ovirt-utils.c | 4 +++-
govirt/ovirt-vm.c | 10 +++++++---
po/POTFILES.in | 8 ++++++++
9 files changed, 52 insertions(+), 22 deletions(-)
---
diff --git a/govirt/ovirt-action-rest-call.c b/govirt/ovirt-action-rest-call.c
index e59c73b..803cb87 100644
--- a/govirt/ovirt-action-rest-call.c
+++ b/govirt/ovirt-action-rest-call.c
@@ -22,6 +22,8 @@
#include <config.h>
+#include <glib/gi18n-lib.h>
+
#include "ovirt-action-rest-call.h"
#include "ovirt-proxy.h"
#include "ovirt-rest-call-error.h"
@@ -52,7 +54,7 @@ static gboolean ovirt_action_rest_call_class_serialize_params(RestProxyCall *cal
params = rest_proxy_call_get_params(call);
if (!rest_params_are_strings(params)) {
g_set_error(error, OVIRT_REST_CALL_ERROR, 0,
- "unexpected parameter type in REST call");
+ _("Unexpected parameter type in REST call"));
return FALSE;
}
diff --git a/govirt/ovirt-collection.c b/govirt/ovirt-collection.c
index 24254b0..52829f1 100644
--- a/govirt/ovirt-collection.c
+++ b/govirt/ovirt-collection.c
@@ -24,6 +24,8 @@
#include <string.h>
+#include <glib/gi18n-lib.h>
+
#include "ovirt-collection.h"
#include "ovirt-error.h"
#include "govirt-private.h"
@@ -236,7 +238,7 @@ ovirt_collection_refresh_from_xml(OvirtCollection *collection,
if (strcmp(root_node->name, collection->priv->collection_xml_name) != 0) {
g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED,
- "Got '%s' node, expected '%s'", root_node->name,
+ _("Got '%s' node, expected '%s'"), root_node->name,
collection->priv->collection_xml_name);
return FALSE;
}
diff --git a/govirt/ovirt-options.c b/govirt/ovirt-options.c
index a0aec56..66f812c 100644
--- a/govirt/ovirt-options.c
+++ b/govirt/ovirt-options.c
@@ -22,6 +22,7 @@
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
+#include <glib/gi18n-lib.h>
#include "ovirt-options.h"
@@ -46,15 +47,16 @@ GOptionGroup* ovirt_get_option_group(void)
{
const GOptionEntry entries[] = {
{ "ovirt-ca-file", '\0', 0, G_OPTION_ARG_FILENAME, &ca_file,
- "Root CA certificate file for secure SSL connections", "<file>" },
+ N_("Root CA certificate file for secure SSL connections"), N_("<file>") },
{ "ovirt-version", '\0', G_OPTION_FLAG_NO_ARG, G_OPTION_ARG_CALLBACK, option_version,
- "Display libgovirt version information", NULL },
+ N_("Display libgovirt version information"), NULL },
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
};
GOptionGroup *grp;
- grp = g_option_group_new("ovirt", "oVirt Options:", "Show oVirt Options", NULL, NULL);
+ grp = g_option_group_new("ovirt", _("oVirt Options:"), _("Show oVirt Options"), NULL, NULL);
g_option_group_add_entries(grp, entries);
+ g_option_group_set_translation_domain(grp, GETTEXT_PACKAGE);
return grp;
}
diff --git a/govirt/ovirt-proxy.c b/govirt/ovirt-proxy.c
index 4869cc5..f22b934 100644
--- a/govirt/ovirt-proxy.c
+++ b/govirt/ovirt-proxy.c
@@ -34,6 +34,7 @@
#include <errno.h>
#include <string.h>
#include <glib/gstdio.h>
+#include <glib/gi18n-lib.h>
#include <libsoup/soup-cookie.h>
#include <rest/rest-xml-node.h>
#include <rest/rest-xml-parser.h>
@@ -495,7 +496,7 @@ static char *write_to_tmp_file(const char *template,
if ((errno != EINTR) || (errno != EAGAIN)) {
g_set_error(error, G_FILE_ERROR,
g_file_error_from_errno(errno),
- "Failed to write to '%s': %s",
+ _("Failed to write to '%s': %s"),
tmp_file, strerror(errno));
goto end;
}
@@ -513,7 +514,7 @@ end:
if (close_status != 0) {
g_set_error(error, G_FILE_ERROR,
g_file_error_from_errno(errno),
- "Failed to close '%s': %s",
+ _("Failed to close '%s': %s"),
result, strerror(errno));
g_free(result);
result = NULL;
@@ -578,7 +579,8 @@ gboolean ovirt_proxy_fetch_ca_certificate(OvirtProxy *proxy, GError **error)
source = get_ca_cert_file(proxy);
if (source == NULL) {
- g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_BAD_URI, "could not extract ca cert filename from URI");
+ g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_BAD_URI,
+ _("Could not extract ca cert filename from URI"));
goto error;
}
diff --git a/govirt/ovirt-resource-rest-call.c b/govirt/ovirt-resource-rest-call.c
index 8f2e0ef..87892e2 100644
--- a/govirt/ovirt-resource-rest-call.c
+++ b/govirt/ovirt-resource-rest-call.c
@@ -24,6 +24,7 @@
#include <string.h>
+#include <glib/gi18n-lib.h>
#include <libsoup/soup.h>
#include <rest/rest-params.h>
@@ -142,7 +143,7 @@ static gboolean ovirt_resource_rest_call_class_serialize_params(RestProxyCall *c
params = rest_proxy_call_get_params(call);
if (!rest_params_are_strings(params)) {
g_set_error(error, OVIRT_REST_CALL_ERROR, 0,
- "unexpected parameter type in REST call");
+ _("Unexpected parameter type in REST call"));
return FALSE;
}
append_params(self, params);
diff --git a/govirt/ovirt-resource.c b/govirt/ovirt-resource.c
index f01bd20..ec79348 100644
--- a/govirt/ovirt-resource.c
+++ b/govirt/ovirt-resource.c
@@ -24,6 +24,7 @@
#include <string.h>
+#include <glib/gi18n-lib.h>
#include <rest/rest-xml-node.h>
#include <rest/rest-xml-parser.h>
@@ -175,7 +176,7 @@ static gboolean ovirt_resource_initable_init(GInitable *initable,
if (cancellable != NULL) {
g_set_error_literal (error, OVIRT_ERROR, OVIRT_ERROR_NOT_SUPPORTED,
- "Cancellable initialization not supported");
+ _("Cancellable initialization not supported"));
return FALSE;
}
@@ -426,14 +427,14 @@ static gboolean ovirt_resource_init_from_xml_real(OvirtResource *resource,
guid = rest_xml_node_get_attr(node, "id");
if ((guid == NULL) && !is_api) {
g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED,
- "missing mandatory 'id' attribute");
+ _("Missing mandatory 'id' attribute"));
return FALSE;
}
href = rest_xml_node_get_attr(node, "href");
if ((href == NULL) && !is_api) {
g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED,
- "missing mandatory 'href' attribute");
+ _("Missing mandatory 'href' attribute"));
return FALSE;
}
@@ -685,29 +686,35 @@ static enum OvirtResponseStatus parse_action_status(RestXmlNode *root,
node = g_hash_table_lookup(root->children, status_key);
if (node == NULL) {
- g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED, "could not find 'status' node");
+ g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED,
+ _("Could not find 'status' node"));
g_return_val_if_reached(OVIRT_RESPONSE_UNKNOWN);
}
node = g_hash_table_lookup(node->children, state_key);
if (node == NULL) {
- g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED, "could not find 'state' node");
+ g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED,
+ _("Could not find 'state' node"));
g_return_val_if_reached(OVIRT_RESPONSE_UNKNOWN);
}
g_debug("State: %s\n", node->content);
if (g_strcmp0(node->content, "complete") == 0) {
return OVIRT_RESPONSE_COMPLETE;
} else if (g_strcmp0(node->content, "pending") == 0) {
- g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_ACTION_FAILED, "action is pending");
+ g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_ACTION_FAILED,
+ _("Action is pending"));
return OVIRT_RESPONSE_PENDING;
} else if (g_strcmp0(node->content, "in_progress") == 0) {
- g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_ACTION_FAILED, "action is in progress");
+ g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_ACTION_FAILED,
+ _("Action is in progress"));
return OVIRT_RESPONSE_IN_PROGRESS;
} else if (g_strcmp0(node->content, "failed") == 0) {
- g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_ACTION_FAILED, "action has failed");
+ g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_ACTION_FAILED,
+ _("Action has failed"));
return OVIRT_RESPONSE_FAILED;
}
- g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED, "unknown action failure");
+ g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED,
+ _("Unknown action failure"));
g_return_val_if_reached(OVIRT_RESPONSE_UNKNOWN);
}
diff --git a/govirt/ovirt-utils.c b/govirt/ovirt-utils.c
index 0654280..77a3f8e 100644
--- a/govirt/ovirt-utils.c
+++ b/govirt/ovirt-utils.c
@@ -25,6 +25,7 @@
#include <errno.h>
#include <string.h>
+#include <glib/gi18n-lib.h>
#include <rest/rest-xml-parser.h>
#include "ovirt-utils.h"
@@ -188,7 +189,8 @@ G_GNUC_INTERNAL gboolean ovirt_utils_gerror_from_xml_fault(RestXmlNode *root, GE
reason_node = g_hash_table_lookup(root->children, reason_key);
if (reason_node == NULL) {
- g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED, "could not find 'reason' node");
+ g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED,
+ _("Could not find 'reason' node"));
g_return_val_if_reached(FALSE);
}
g_debug("Reason: %s\n", reason_node->content);
diff --git a/govirt/ovirt-vm.c b/govirt/ovirt-vm.c
index 42f705f..04b8089 100644
--- a/govirt/ovirt-vm.c
+++ b/govirt/ovirt-vm.c
@@ -23,6 +23,7 @@
#include <config.h>
#include <stdlib.h>
+#include <glib/gi18n-lib.h>
#include <rest/rest-xml-node.h>
#include <rest/rest-xml-parser.h>
@@ -260,12 +261,14 @@ static gboolean parse_ticket_status(RestXmlNode *root, OvirtResource *resource,
vm = OVIRT_VM(resource);
root = g_hash_table_lookup(root->children, ticket_key);
if (root == NULL) {
- g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED, "could not find 'ticket' node");
+ g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED,
+ _("Could not find 'ticket' node"));
g_return_val_if_reached(FALSE);
}
node = g_hash_table_lookup(root->children, value_key);
if (node == NULL) {
- g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED, "could not find 'value' node");
+ g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED,
+ _("Could not find 'value' node"));
g_return_val_if_reached(FALSE);
}
@@ -277,7 +280,8 @@ static gboolean parse_ticket_status(RestXmlNode *root, OvirtResource *resource,
node = g_hash_table_lookup(root->children, expiry_key);
if (node == NULL) {
- g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED, "could not find 'expiry' node");
+ g_set_error(error, OVIRT_ERROR, OVIRT_ERROR_PARSING_FAILED,
+ _("Could not find 'expiry' node"));
g_object_unref(G_OBJECT(display));
g_return_val_if_reached(FALSE);
}
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e69de29..2c7619a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -0,0 +1,8 @@
+govirt/ovirt-action-rest-call.c
+govirt/ovirt-collection.c
+govirt/ovirt-options.c
+govirt/ovirt-proxy.c
+govirt/ovirt-resource-rest-call.c
+govirt/ovirt-resource.c
+govirt/ovirt-utils.c
+govirt/ovirt-vm.c
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]