Commit 02ecfaf7 authored by Daniel P. Berrange's avatar Daniel P. Berrange

Add basic support for i18n

Add intltool/gettext framework and marked all strings for
translation
Signed-off-by: 's avatarDaniel P. Berrange <berrange@redhat.com>
parent f7613b14
......@@ -21,12 +21,20 @@ m4/ltsugar.m4
m4/ltoptions.m4
m4/lt~obsolete.m4
m4/ltversion.m4
m4/intltool.m4
po/Makefile.in.in
po/Makefile.in
po/Makefile
po/POTFILES
po/stamp-it
po/libvirt-sandbox.pot
stamp-h1
INSTALL
libvirt-sandbox-1.0.pc
libvirt-sandbox.spec
.deps/
.libs/
.tx/
libvirt-sandbox/LibvirtSandbox-1.0.gir
libvirt-sandbox/LibvirtSandbox-1.0.typelib
*.lo
......
SUBDIRS = libvirt-sandbox bin examples docs
SUBDIRS = libvirt-sandbox bin examples docs po
ACLOCAL_AMFLAGS = -I m4
......
......@@ -10,21 +10,14 @@ cd $srcdir
DIE=0
(autoconf --version) < /dev/null > /dev/null 2>&1 || {
for prog in intltoolize autoreconf automake autoconf libtool
do
($prog --version) < /dev/null > /dev/null 2>&1 || {
echo
echo "You must have autoconf installed to compile libvirt-sandbox."
echo "Download the appropriate package for your distribution,"
echo "or see http://www.gnu.org/software/autoconf"
echo "You must have $prog installed to compile libvirt-sandbox."
DIE=1
}
(automake --version) < /dev/null > /dev/null 2>&1 || {
echo
DIE=1
echo "You must have automake installed to compile libvirt-sandbox."
echo "Download the appropriate package for your distribution,"
echo "or see http://www.gnu.org/software/automake"
}
}
done
if test "$DIE" -eq 1; then
exit 1
......@@ -37,11 +30,8 @@ if test -z "$*"; then
fi
mkdir -p build-aux
libtoolize --copy --force
aclocal -I m4
autoheader
automake --add-missing
autoconf
intltoolize --force
autoreconf -if
cd $THEDIR
......
......@@ -58,6 +58,7 @@ virt_sandbox_CFLAGS = \
$(GIO_UNIX_CFLAGS) \
$(LIBVIRT_GOBJECT_CFLAGS) \
-I$(top_srcdir) \
-DLOCALEDIR="\"$(datadir)/locale"\" \
$(WARN_CFLAGS) \
$(NULL)
virt_sandbox_LDFLAGS = \
......@@ -72,6 +73,7 @@ virt_sandbox_service_util_CFLAGS = \
$(GIO_UNIX_CFLAGS) \
$(LIBVIRT_GOBJECT_CFLAGS) \
-I$(top_srcdir) \
-DLOCALEDIR="\"$(datadir)/locale"\" \
$(WARN_CFLAGS) \
$(NULL)
virt_sandbox_service_util_LDFLAGS = \
......
......@@ -19,8 +19,6 @@
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
PROGNAME="virt-sandbox-service"
from gi.repository import LibvirtGObject
from gi.repository import LibvirtSandbox
from gi.repository import GLib
......@@ -39,10 +37,10 @@ else:
LibvirtGObject.init_object_check(None)
LibvirtSandbox.init_check(None)
gettext.bindtextdomain(PROGNAME, "/usr/share/locale")
gettext.textdomain(PROGNAME)
gettext.bindtextdomain("libvirt-sandbox", "/usr/share/locale")
gettext.textdomain("libvirt-sandbox")
try:
gettext.install(PROGNAME,
gettext.install("libvirt-sandbox",
localedir="/usr/share/locale",
unicode=False,
codeset = 'utf-8')
......
......@@ -386,6 +386,11 @@ int main(int argc, char **argv) {
};
const char *help_msg = N_("Run 'virt-sandbox-service-util --help' to see a full list of available command line options\n");
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE);
if (!gvir_sandbox_init_check(&argc, &argv, &err))
exit(EXIT_FAILURE);
......
......@@ -106,6 +106,11 @@ int main(int argc, char **argv) {
};
const char *help_msg = N_("Run 'virt-sandbox --help' to see a full list of available command line options");
setlocale(LC_ALL, "");
bindtextdomain(PACKAGE, LOCALEDIR);
bind_textdomain_codeset(PACKAGE, "UTF-8");
textdomain(PACKAGE);
if (!gvir_sandbox_init_check(&argc, &argv, &error))
exit(EXIT_FAILURE);
......@@ -141,7 +146,7 @@ int main(int argc, char **argv) {
hv = gvir_connection_new(uri);
if (!gvir_connection_open(hv, NULL, &error)) {
g_printerr(_("Unable to open connection: %s\n"),
error && error->message ? error->message : "unknown");
error && error->message ? error->message : _("Unknown failure"));
goto cleanup;
}
......@@ -158,31 +163,31 @@ int main(int argc, char **argv) {
if (mounts &&
!gvir_sandbox_config_add_mount_strv(cfg, mounts, &error)) {
g_printerr(_("Unable to parse mounts: %s\n"),
error && error->message ? error->message : "unknown");
error && error->message ? error->message : _("Unknown failure"));
goto cleanup;
}
if (includes &&
!gvir_sandbox_config_add_host_include_strv(cfg, includes, &error)) {
g_printerr(_("Unable to parse includes: %s\n"),
error && error->message ? error->message : "unknown");
error && error->message ? error->message : _("Unknown failure"));
goto cleanup;
}
if (includefile &&
!gvir_sandbox_config_add_host_include_file(cfg, includefile, &error)) {
g_printerr(_("Unable to parse include file: %s\n"),
error && error->message ? error->message : "unknown");
error && error->message ? error->message : _("Unknown failure"));
goto cleanup;
}
if (networks &&
!gvir_sandbox_config_add_network_strv(cfg, networks, &error)) {
g_printerr(_("Unable to parse networks: %s\n"),
error && error->message ? error->message : "unknown");
error && error->message ? error->message : _("Unknown failure"));
goto cleanup;
}
if (security &&
!gvir_sandbox_config_set_security_opts(cfg, security, &error)) {
g_printerr(_("Unable to parse security: %s\n"),
error && error->message ? error->message : "unknown");
error && error->message ? error->message : _("Unknown failure"));
goto cleanup;
}
......@@ -197,26 +202,26 @@ int main(int argc, char **argv) {
if (!gvir_sandbox_context_start(ctx, &error)) {
g_printerr(_("Unable to start sandbox: %s\n"),
error && error->message ? error->message : "unknown");
error && error->message ? error->message : _("Unknown failure"));
goto cleanup;
}
if (!(log = gvir_sandbox_context_get_log_console(ctx, &error))) {
g_printerr(_("Unable to get log console: %s\n"),
error && error->message ? error->message : "unknown");
error && error->message ? error->message : _("Unknown failure"));
goto cleanup;
}
g_signal_connect(log, "closed", (GCallback)do_close, loop);
if (!(gvir_sandbox_console_attach_stderr(log, &error))) {
g_printerr(_("Unable to attach sandbox console: %s\n"),
error && error->message ? error->message : "unknown");
error && error->message ? error->message : _("Unknown failure"));
goto cleanup;
}
if (!(con = gvir_sandbox_context_interactive_get_app_console(ictx, &error))) {
g_printerr(_("Unable to get app console: %s\n"),
error && error->message ? error->message : "unknown");
error && error->message ? error->message : _("Unknown failure"));
goto cleanup;
}
g_signal_connect(con, "closed", (GCallback)do_close, loop);
......@@ -224,7 +229,7 @@ int main(int argc, char **argv) {
if (!(gvir_sandbox_console_attach_stdio(con, &error))) {
g_printerr(_("Unable to attach sandbox console: %s\n"),
error && error->message ? error->message : "unknown");
error && error->message ? error->message : _("Unknown failure"));
goto cleanup;
}
......
......@@ -61,6 +61,30 @@ VC_LIST_ALWAYS_EXCLUDE_REGEX = \
useless_free_options = \
--name=g_free
msg_gen_function =
msg_gen_function += g_set_error
msg_gen_function += g_printerr
func_or := $(shell echo $(msg_gen_function)|tr -s ' ' '|')
func_re := ($(func_or))
# Look for diagnostics that aren't marked for translation.
# This won't find any for which error's format string is on a separate line.
# The sed filters eliminate false-positives like these:
# _("...: "
# "%s", _("no storage vol w..."
sc_libvirt_unmarked_diagnostics:
@prohibit='\<$(func_re) *\([^"]*"[^"]*[a-z]{3}' \
exclude='_\(' \
halt='found unmarked diagnostic(s)' \
$(_sc_search_regexp)
@{ grep -nE '\<$(func_re) *\(.*;$$' $$($(VC_LIST_EXCEPT)); \
grep -A1 -nE '\<$(func_re) *\(.*,$$' $$($(VC_LIST_EXCEPT)); } \
| sed 's/_("\([^\"]\|\\.\)\+"//;s/[ ]"%s"//' \
| grep '[ ]"' && \
{ echo '$(ME): found unmarked diagnostic(s)' 1>&2; \
exit 1; } || :
# Ensure that no C source file, docs, or rng schema uses TABs for
# indentation. Also match *.h.in files, to get libvirt.h.in. Exclude
# files in gnulib, since they're imported.
......@@ -118,6 +142,7 @@ sc_check_author_list:
&& echo '$(ME): committer(s) not listed in AUTHORS' >&2; \
test $$fail = 0
exclude_file_name_regexp--sc_libvirt_unmarked_diagnostics = ^libvirt-sandbox/tests
exclude_file_name_regexp--sc_bindtextdomain = ^(libvirt-sandbox/tests)|(libvirt-sandbox/libvirt-sandbox-init-*)|(bin/virt-sandbox.c)|(bin/virt-sandbox-service-util.c)
......
......@@ -86,6 +86,10 @@ LIBVIRT_SANDBOX_INTROSPECTION
LIBVIRT_SANDBOX_RPCGEN
LIBVIRT_SANDBOX_SELINUX
dnl Should be in m4/virt-gettext.m4 but intltoolize is too
dnl dumb to find it there
IT_PROG_INTLTOOL([0.35.0])
AC_OUTPUT(Makefile
libvirt-sandbox/Makefile
......@@ -94,6 +98,7 @@ AC_OUTPUT(Makefile
examples/Makefile
docs/Makefile
docs/libvirt-sandbox/Makefile
po/Makefile.in
libvirt-sandbox.spec
libvirt-sandbox-1.0.pc)
......
......@@ -131,6 +131,7 @@ libvirt_sandbox_1_0_la_CFLAGS = \
-DLIBEXECDIR="\"$(libexecdir)\"" \
-DSANDBOXCONFIGDIR="\"$(sandboxconfigdir)\"" \
-DRUNDIR="\"$(rundir)\"" \
-DLOCALEDIR="\"$(datadir)/locale"\" \
$(COVERAGE_CFLAGS) \
-I$(top_srcdir) \
$(GIO_UNIX_CFLAGS) \
......@@ -161,6 +162,7 @@ libvirt_sandbox_init_common_SOURCES = libvirt-sandbox-init-common.c \
libvirt_sandbox_init_common_CFLAGS = \
-DLIBEXECDIR="\"$(libexecdir)\"" \
-DSANDBOXCONFIGDIR="\"$(sandboxconfigdir)\"" \
-DLOCALEDIR="\"$(datadir)/locale"\" \
$(COVERAGE_CFLAGS) \
-I$(top_srcdir) \
$(GIO_UNIX_CFLAGS) \
......
......@@ -23,6 +23,8 @@
#include <config.h>
#include <string.h>
#include <glib/gi18n.h>
#include "libvirt-sandbox/libvirt-sandbox.h"
/**
......@@ -376,7 +378,7 @@ static gboolean gvir_sandbox_builder_container_construct_devices(GVirSandboxBuil
if (GVIR_SANDBOX_IS_CONFIG_GRAPHICAL(config)) {
g_set_error(error, GVIR_SANDBOX_BUILDER_CONTAINER_ERROR, 0,
"%s", "Graphical sandboxes are not supported for containers");
"%s", _("Graphical sandboxes are not supported for containers"));
return FALSE;
}
......
......@@ -26,6 +26,8 @@
#include <errno.h>
#include <dirent.h>
#include <glib/gi18n.h>
#include "libvirt-sandbox/libvirt-sandbox.h"
/**
......@@ -166,7 +168,7 @@ static gchar *gvir_sandbox_builder_initrd_create_tempdir(GError **error)
if (!dir) {
g_set_error(error, GVIR_SANDBOX_BUILDER_INITRD_ERROR, errno,
"Unable to create temporary directory %s: %s",
_("Unable to create temporary directory %s: %s"),
tmpl, strerror(errno));
goto cleanup;
}
......@@ -262,7 +264,7 @@ static GList *gvir_sandbox_builder_initrd_find_files(GList *modnames,
DIR *dh = opendir(g_file_get_path(dir));
if (!dh) {
g_set_error(error, GVIR_SANDBOX_BUILDER_INITRD_ERROR, 0,
"Unable to read entries in %s: %s",
_("Unable to read entries in %s: %s"),
g_file_get_path(dir), strerror(errno));
return NULL;
}
......@@ -293,7 +295,7 @@ static GList *gvir_sandbox_builder_initrd_find_files(GList *modnames,
struct stat sb;
if (stat(g_file_get_path(child), &sb) < 0) {
g_set_error(error, GVIR_SANDBOX_BUILDER_INITRD_ERROR, 0,
"Unable to access %s: %s",
_("Unable to access %s: %s"),
g_file_get_path(child) , strerror(errno));
g_object_unref(child);
goto cleanup;
......@@ -354,7 +356,7 @@ static GList *gvir_sandbox_builder_initrd_find_modules(GList *modnames,
}
if (!found) {
g_set_error(error, GVIR_SANDBOX_BUILDER_INITRD_ERROR, 0,
"Cannot find module file for %s", (const gchar*)tmp1->data);
_("Cannot find module file for %s"), (const gchar*)tmp1->data);
g_list_foreach(modfiles, (GFunc)g_object_unref, NULL);
g_list_free(modfiles);
modfiles = NULL;
......
......@@ -24,6 +24,8 @@
#include <string.h>
#include <sys/utsname.h>
#include <glib/gi18n.h>
#include "libvirt-sandbox/libvirt-sandbox.h"
/**
......@@ -176,7 +178,7 @@ static gchar *gvir_sandbox_builder_machine_mkinitrd(GVirSandboxConfig *config,
if ((fd = mkstemp(targetfile)) < 0) {
g_set_error(error, GVIR_SANDBOX_BUILDER_MACHINE_ERROR, 0,
"Cannot create initrd %s", targetfile);
_("Cannot create initrd %s"), targetfile);
goto cleanup;
}
......
......@@ -24,6 +24,8 @@
#include <sys/utsname.h>
#include <string.h>
#include <glib/gi18n.h>
#include "libvirt-sandbox/libvirt-sandbox.h"
/**
......@@ -876,7 +878,7 @@ gboolean gvir_sandbox_config_add_network_opts(GVirSandboxConfig *config,
if (g_str_equal(param, "dhcp")) {
if (gotaddr || gotroute) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Cannot request DHCP with static routes/addresses");
_("Cannot request DHCP with static routes/addresses"));
g_object_unref(net);
goto cleanup;
}
......@@ -897,7 +899,7 @@ gboolean gvir_sandbox_config_add_network_opts(GVirSandboxConfig *config,
if (gotdhcp) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Cannot set static addresses with DHCP");
_("Cannot set static addresses with DHCP"));
g_object_unref(net);
goto cleanup;
}
......@@ -917,7 +919,7 @@ gboolean gvir_sandbox_config_add_network_opts(GVirSandboxConfig *config,
if (!(primaryaddr = g_inet_address_new_from_string(primary))) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Unable to parse address %s", primary);
_("Unable to parse address %s"), primary);
g_free(primary);
g_object_unref(net);
goto cleanup;
......@@ -926,7 +928,7 @@ gboolean gvir_sandbox_config_add_network_opts(GVirSandboxConfig *config,
if (bcast &&
!(bcastaddr = g_inet_address_new_from_string(bcast))) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Unable to parse address %s", bcast);
_("Unable to parse address %s"), bcast);
g_free(primary);
g_object_unref(primaryaddr);
g_object_unref(net);
......@@ -956,7 +958,7 @@ gboolean gvir_sandbox_config_add_network_opts(GVirSandboxConfig *config,
if (gotdhcp) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Cannot set static routes with DHCP");
_("Cannot set static routes with DHCP"));
g_object_unref(net);
goto cleanup;
}
......@@ -976,7 +978,7 @@ gboolean gvir_sandbox_config_add_network_opts(GVirSandboxConfig *config,
if (!(targetaddr = g_inet_address_new_from_string(target))) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Unable to parse address %s", target);
_("Unable to parse address %s"), target);
g_free(target);
g_object_unref(net);
goto cleanup;
......@@ -984,7 +986,7 @@ gboolean gvir_sandbox_config_add_network_opts(GVirSandboxConfig *config,
if (!(gatewayaddr = g_inet_address_new_from_string(gateway))) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Unable to parse address %s", gateway);
_("Unable to parse address %s"), gateway);
g_free(target);
g_object_unref(targetaddr);
g_object_unref(net);
......@@ -1004,7 +1006,7 @@ gboolean gvir_sandbox_config_add_network_opts(GVirSandboxConfig *config,
gvir_sandbox_config_network_set_dhcp(net, FALSE);
} else {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Unknown parameter %s", param);
_("Unknown parameter %s"), param);
g_object_unref(net);
goto cleanup;
}
......@@ -1015,7 +1017,7 @@ gboolean gvir_sandbox_config_add_network_opts(GVirSandboxConfig *config,
if (gotroute && !gotaddr) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Cannot set static routes without addresses");
_("Cannot set static routes without addresses"));
g_object_unref(net);
goto cleanup;
}
......@@ -1177,7 +1179,7 @@ gboolean gvir_sandbox_config_add_mount_opts(GVirSandboxConfig *config,
tmp = strchr(mount, ':');
if (!tmp) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"No mount type prefix on %s", mount);
_("No mount type prefix on %s"), mount);
return FALSE;
}
if (strncmp(mount, "host-bind", (tmp - mount)) == 0) {
......@@ -1190,7 +1192,7 @@ gboolean gvir_sandbox_config_add_mount_opts(GVirSandboxConfig *config,
type = GVIR_SANDBOX_TYPE_CONFIG_MOUNT_RAM;
} else {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Unknown mount type prefix on %s", mount);
_("Unknown mount type prefix on %s"), mount);
return FALSE;
}
......@@ -1300,7 +1302,7 @@ gboolean gvir_sandbox_config_add_host_include_strv(GVirSandboxConfig *config,
}
if (!mnt) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"No mount with a prefix under %s", guest);
_("No mount with a prefix under %s"), guest);
g_free(guest);
return FALSE;
}
......@@ -1365,7 +1367,7 @@ gboolean gvir_sandbox_config_add_host_include_file(GVirSandboxConfig *config,
}
if (!mnt) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"No mount with a prefix under %s", guest);
_("No mount with a prefix under %s"), guest);
g_free(guest);
return FALSE;
}
......@@ -1464,7 +1466,7 @@ gboolean gvir_sandbox_config_set_security_opts(GVirSandboxConfig *config,
gvir_sandbox_config_set_security_dynamic(config, FALSE);
} else {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Unknown security option '%s'", tmp);
_("Unknown security option '%s'"), tmp);
goto cleanup;
}
......@@ -1473,7 +1475,7 @@ gboolean gvir_sandbox_config_set_security_opts(GVirSandboxConfig *config,
gvir_sandbox_config_set_security_label(config, offset+6);
} else {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Unknown security option '%s'", offset);
_("Unknown security option '%s'"), offset);
goto cleanup;
}
}
......@@ -1507,12 +1509,12 @@ static GVirSandboxConfigMount *gvir_sandbox_config_load_config_mount(GKeyFile *f
}
g_error_free(e);
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"%s", "Missing mount target in config file");
"%s", _("Missing mount target in config file"));
goto cleanup;
}
if ((type = g_key_file_get_string(file, key, "type", NULL)) == NULL) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"%s", "Missing mount type in config file");
"%s", _("Missing mount type in config file"));
goto cleanup;
}
......@@ -1524,14 +1526,14 @@ static GVirSandboxConfigMount *gvir_sandbox_config_load_config_mount(GKeyFile *f
if ((mountType = g_type_from_name(type)) == 0) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Unknown mount type %s in config file", type);
_("Unknown mount type %s in config file"), type);
goto error;
}
if (mountType == GVIR_SANDBOX_TYPE_CONFIG_MOUNT_RAM) {
if ((source = g_key_file_get_string(file, key, "usage", NULL)) == NULL) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"%s", "Missing mount usage in config file");
"%s", _("Missing mount usage in config file"));
goto error;
}
gint usage = strtol(source, NULL, 10);
......@@ -1540,7 +1542,7 @@ static GVirSandboxConfigMount *gvir_sandbox_config_load_config_mount(GKeyFile *f
} else {
if ((source = g_key_file_get_string(file, key, "source", NULL)) == NULL) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"%s", "Missing mount source in config file");
"%s", _("Missing mount source in config file"));
goto error;
}
......@@ -2023,20 +2025,20 @@ GVirSandboxConfig *gvir_sandbox_config_load_from_path(const gchar *path,
if ((str = g_key_file_get_string(file, "api", "class", NULL)) == NULL) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"%s", "Missing class name in config file");
"%s", _("Missing class name in config file"));
goto cleanup;
}
if (!(type = g_type_from_name(str))) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Unknown type name '%s' in config file", str);
_("Unknown type name '%s' in config file"), str);
goto cleanup;
}
if (!g_type_is_a(type,
GVIR_SANDBOX_TYPE_CONFIG)) {
g_set_error(error, GVIR_SANDBOX_CONFIG_ERROR, 0,
"Type name '%s' in config file had wrong parent", str);
_("Type name '%s' in config file had wrong parent"), str);
goto cleanup;
}
......
......@@ -26,6 +26,8 @@
#include <termios.h>
#include <errno.h>
#include <string.h>
#include <glib/gi18n.h>
#include <libvirt-glib/libvirt-glib-error.h>
#include "libvirt-sandbox/libvirt-sandbox.h"
......@@ -167,7 +169,7 @@ static gboolean gvir_sandbox_console_raw_start_term(GVirSandboxConsoleRaw *conso
if (tcgetattr(fd, &priv->termiosProps) < 0) {
g_set_error(error, GVIR_SANDBOX_CONSOLE_RAW_ERROR, 0,
"Unable to query terminal attributes: %s",
_("Unable to query terminal attributes: %s"),
strerror(errno));
return FALSE;
}
......@@ -184,7 +186,7 @@ static gboolean gvir_sandbox_console_raw_start_term(GVirSandboxConsoleRaw *conso
if (tcsetattr(fd, TCSADRAIN, &ios) < 0) {
g_set_error(error, GVIR_SANDBOX_CONSOLE_RAW_ERROR, 0,
"Unable to update terminal attributes: %s",
_("Unable to update terminal attributes: %s"),
strerror(errno));
return FALSE;
}
......@@ -207,7 +209,7 @@ static gboolean gvir_sandbox_console_raw_stop_term(GVirSandboxConsoleRaw *consol
if (tcsetattr(fd, TCSADRAIN, &priv->termiosProps) < 0) {
g_set_error(error, GVIR_SANDBOX_CONSOLE_RAW_ERROR, 0,
"Unable to restore terminal attributes: %s",
_("Unable to restore terminal attributes: %s"),
strerror(errno));
return FALSE;
}
......@@ -477,7 +479,7 @@ static gboolean gvir_sandbox_console_raw_attach(GVirSandboxConsole *console,
if (priv->console) {
g_set_error(error, GVIR_SANDBOX_CONSOLE_RAW_ERROR, 0, "%s",
"Console is already attached to a stream");
_("Console is already attached to a stream"));
return FALSE;
}
......@@ -535,7 +537,7 @@ static gboolean gvir_sandbox_console_raw_detach(GVirSandboxConsole *console,
return TRUE;
#if 0
g_set_error(error, GVIR_SANDBOX_CONSOLE_RAW_ERROR, 0, "%s",
"Console is not attached to a stream");
_("Console is not attached to a stream"));
return FALSE;
#endif
}
......
......@@ -26,10 +26,11 @@
#include <termios.h>
#include <errno.h>
#include <string.h>
#include <glib/gi18n.h>
#include <libvirt-glib/libvirt-glib-error.h>
#include "libvirt-sandbox/libvirt-sandbox.h"
#include "libvirt-sandbox/libvirt-sandbox-rpcpacket.h"
/**
......@@ -296,7 +297,7 @@ static gboolean gvir_sandbox_console_rpc_start_term(GVirSandboxConsoleRpc *conso
if (tcgetattr(fd, &priv->termiosProps) < 0) {
g_set_error(error, GVIR_SANDBOX_CONSOLE_RPC_ERROR, 0,
"Unable to query terminal attributes: %s",
_("Unable to query terminal attributes: %s"),
strerror(errno));
return FALSE;
}
......@@ -313,7 +314,7 @@ static gboolean gvir_sandbox_console_rpc_start_term(GVirSandboxConsoleRpc *conso
if (tcsetattr(fd, TCSADRAIN, &ios) < 0) {
g_set_error(error, GVIR_SANDBOX_CONSOLE_RPC_ERROR, 0,
"Unable to update terminal attributes: %s",
_("Unable to update terminal attributes: %s"),
strerror(errno));
return FALSE;
}
......@@ -341,7 +342,7 @@ static gboolean gvir_sandbox_console_rpc_stop_term(GVirSandboxConsoleRpc *consol
if (tcsetattr(fd, TCSADRAIN, &priv->termiosProps) < 0) {
g_set_error(error, GVIR_SANDBOX_CONSOLE_RPC_ERROR, 0,
"Unable to restore terminal attributes: %s",
_("Unable to restore terminal attributes: %s"),
strerror(errno));
return FALSE;
}
......@@ -468,7 +469,7 @@ static gboolean do_console_rpc_dispatch(GVirSandboxConsoleRpc *console,
return FALSE;
if (priv->rx->header.status != GVIR_SANDBOX_PROTOCOL_STATUS_OK) {
g_set_error(error, 0, 0, "Unexpected rpc status %u",
g_set_error(error, 0, 0, _("Unexpected rpc status %u"),
priv->rx->header.status);
return FALSE;
}
......@@ -513,7 +514,7 @@ static gboolean do_console_rpc_dispatch(GVirSandboxConsoleRpc *console,
case GVIR_SANDBOX_PROTOCOL_PROC_QUIT:
case GVIR_SANDBOX_PROTOCOL_PROC_STDIN:
default:
g_set_error(error, 0, 0, "Unexpected rpc proc %u",
g_set_error(error, 0, 0, _("Unexpected rpc proc %u"),
priv->rx->header.proc);
return FALSE;
}
......@@ -823,7 +824,7 @@ static gboolean gvir_sandbox_console_rpc_attach(GVirSandboxConsole *console,
if (priv->state != GVIR_SANDBOX_CONSOLE_RPC_INIT) {
g_set_error(error, GVIR_SANDBOX_CONSOLE_RPC_ERROR, 0, "%s",
"Console is already attached to a stream");
_("Console is already attached to a stream"));
return FALSE;
}
......@@ -882,7 +883,7 @@ static gboolean gvir_sandbox_console_rpc_detach(GVirSandboxConsole *console,
return TRUE;
#if 0
g_set_error(error, GVIR_SANDBOX_CONSOLE_RPC_ERROR, 0, "%s",
"ConsoleRpc is not attached to a stream");
_("ConsoleRpc is not attached to a stream"));
return FALSE;
#endif
}
......
......@@ -24,6 +24,8 @@
#include <string.h>
#include <glib/gi18n.h>
#include "libvirt-sandbox/libvirt-sandbox.h"
/**
......@@ -270,7 +272,7 @@ GVirDomain *gvir_sandbox_context_get_domain(GVirSandboxContext *ctxt,
if (!priv->domain) {
g_set_error(error, GVIR_SANDBOX_CONTEXT_ERROR, 0,
"Domain is not currently running");
_("Domain is not currently running"));
return NULL;
}
......@@ -493,7 +495,7 @@ GVirSandboxConsole *gvir_sandbox_context_get_log_console(GVirSandboxContext *ctx
if (!priv->console) {
g_set_error(error, GVIR_SANDBOX_CONTEXT_ERROR, 0,
"Domain is not currently running");
_("Domain is not currently running"));
return NULL;
}
......@@ -516,7 +518,7 @@ GVirSandboxConsole *gvir_sandbox_context_get_shell_console(GVirSandboxContext *c
if (!priv->domain) {
g_set_error(error, GVIR_SANDBOX_CONTEXT_ERROR