mirror of
https://gitlab.com/virt-viewer/virt-viewer.git
synced 2025-01-18 06:03:43 +03:00
Add support for i18n of the UI
Add all the boilerplate code required for doing i18n of the UI. No translations available yet though
This commit is contained in:
parent
acf61455a3
commit
50f48b4d91
13
.hgignore
13
.hgignore
@ -22,6 +22,7 @@ Makefile\.in$
|
|||||||
^src/Makefile$
|
^src/Makefile$
|
||||||
^stamp-h1$
|
^stamp-h1$
|
||||||
^virt-viewer\.spec$
|
^virt-viewer\.spec$
|
||||||
|
^mingw32-virt-viewer\.spec$
|
||||||
^config.h.in$
|
^config.h.in$
|
||||||
^man/Makefile$
|
^man/Makefile$
|
||||||
^man/virt-viewer\.1$
|
^man/virt-viewer\.1$
|
||||||
@ -32,3 +33,15 @@ Makefile\.in$
|
|||||||
^plugin/.*\.so
|
^plugin/.*\.so
|
||||||
^plugin/.*\.lo
|
^plugin/.*\.lo
|
||||||
^plugin/Makefile$
|
^plugin/Makefile$
|
||||||
|
^m4/libtool\.m4$
|
||||||
|
^m4/ltoptions\.m4$
|
||||||
|
^m4/ltsugar\.m4$
|
||||||
|
^m4/ltversion\.m4$
|
||||||
|
^m4/lt~obsolete\.m4$
|
||||||
|
^po/POTFILES$
|
||||||
|
.*\.orig$
|
||||||
|
.*\.rej$
|
||||||
|
^po/Makefile\.in\.in$
|
||||||
|
^po/Makefile\.in$
|
||||||
|
^po/Makefile$
|
||||||
|
^po/stamp-it$
|
||||||
|
21
Makefile.am
21
Makefile.am
@ -1,6 +1,21 @@
|
|||||||
|
|
||||||
SUBDIRS = src man plugin
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
EXTRA_DIST = @PACKAGE@.spec
|
SUBDIRS = src man plugin po
|
||||||
|
|
||||||
DISTCLEAN_FILES = @PACKAGE@.spec
|
EXTRA_DIST = @PACKAGE@.spec \
|
||||||
|
intltool-extract.in \
|
||||||
|
intltool-merge.in \
|
||||||
|
intltool-update.in
|
||||||
|
|
||||||
|
DISTCLEAN_FILES = @PACKAGE@.spec \
|
||||||
|
intltool-extract \
|
||||||
|
intltool-merge \
|
||||||
|
intltool-update
|
||||||
|
|
||||||
|
MAINTAINERCLEANFILES = \
|
||||||
|
m4/libtool.m4 \
|
||||||
|
m4/lt~obsolete.m4 \
|
||||||
|
m4/ltoptions.m4 \
|
||||||
|
m4/ltsugar.m4 \
|
||||||
|
m4/ltversion.m4
|
||||||
|
@ -37,9 +37,10 @@ if test -z "$*"; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
libtoolize --copy --force
|
libtoolize --copy --force
|
||||||
aclocal
|
intltoolize --force
|
||||||
|
aclocal -I m4
|
||||||
autoheader
|
autoheader
|
||||||
automake --add-missing
|
automake --add-missing --copy
|
||||||
autoconf
|
autoconf
|
||||||
|
|
||||||
cd $THEDIR
|
cd $THEDIR
|
||||||
|
@ -16,6 +16,14 @@ AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions])
|
|||||||
|
|
||||||
VIRT_VIEWER_COMPILE_WARNINGS(maximum)
|
VIRT_VIEWER_COMPILE_WARNINGS(maximum)
|
||||||
|
|
||||||
|
GETTEXT_PACKAGE=virt-viewer
|
||||||
|
AC_SUBST(GETTEXT_PACKAGE)
|
||||||
|
AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE,"$GETTEXT_PACKAGE", [GETTEXT package name])
|
||||||
|
|
||||||
|
IT_PROG_INTLTOOL([0.35.0])
|
||||||
|
AM_GLIB_GNU_GETTEXT
|
||||||
|
|
||||||
|
|
||||||
PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.6.0)
|
PKG_CHECK_MODULES(LIBXML2, libxml-2.0 >= 2.6.0)
|
||||||
PKG_CHECK_MODULES(LIBVIRT, libvirt >= 0.6.0)
|
PKG_CHECK_MODULES(LIBVIRT, libvirt >= 0.6.0)
|
||||||
PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.10.0)
|
PKG_CHECK_MODULES(GTK2, gtk+-2.0 >= 2.10.0)
|
||||||
@ -52,6 +60,7 @@ AM_CONDITIONAL(ENABLE_PLUGIN, [test "x$enable_plugin" = "xyes"])
|
|||||||
AC_OUTPUT(Makefile
|
AC_OUTPUT(Makefile
|
||||||
src/Makefile
|
src/Makefile
|
||||||
man/Makefile
|
man/Makefile
|
||||||
|
po/Makefile.in
|
||||||
plugin/Makefile
|
plugin/Makefile
|
||||||
virt-viewer.spec
|
virt-viewer.spec
|
||||||
mingw32-virt-viewer.spec)
|
mingw32-virt-viewer.spec)
|
||||||
|
0
intltool-extract.in
Normal file
0
intltool-extract.in
Normal file
0
intltool-merge.in
Normal file
0
intltool-merge.in
Normal file
0
intltool-update.in
Normal file
0
intltool-update.in
Normal file
0
po/LINGUAS
Normal file
0
po/LINGUAS
Normal file
8
po/POTFILES.in
Normal file
8
po/POTFILES.in
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
src/auth.c
|
||||||
|
src/events.c
|
||||||
|
src/main.c
|
||||||
|
src/util.c
|
||||||
|
src/viewer.c
|
||||||
|
src/about.glade
|
||||||
|
src/auth.glade
|
||||||
|
src/viewer.glade
|
@ -27,4 +27,5 @@ virt_viewer_CFLAGS = \
|
|||||||
@LIBGLADE2_CFLAGS@ \
|
@LIBGLADE2_CFLAGS@ \
|
||||||
@LIBVIRT_CFLAGS@ \
|
@LIBVIRT_CFLAGS@ \
|
||||||
@WARN_CFLAGS@ \
|
@WARN_CFLAGS@ \
|
||||||
-DGLADE_DIR="\"$(gladedir)\""
|
-DGLADE_DIR="\"$(gladedir)\"" \
|
||||||
|
-DLOCALE_DIR=\""$(datadir)/locale"\"
|
||||||
|
32
src/main.c
32
src/main.c
@ -21,15 +21,16 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
#include <locale.h>
|
||||||
#include <vncdisplay.h>
|
#include <vncdisplay.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
|
#include <glib/gi18n.h>
|
||||||
|
|
||||||
#include "viewer.h"
|
#include "viewer.h"
|
||||||
|
|
||||||
static void viewer_version(FILE *out)
|
static void viewer_version(FILE *out)
|
||||||
{
|
{
|
||||||
fprintf(out, "%s version %s\n", PACKAGE, VERSION);
|
fprintf(out, _("%s version %s\n"), PACKAGE, VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -46,29 +47,34 @@ int main(int argc, char **argv)
|
|||||||
gboolean direct = FALSE;
|
gboolean direct = FALSE;
|
||||||
gboolean waitvm = FALSE;
|
gboolean waitvm = FALSE;
|
||||||
gboolean reconnect = FALSE;
|
gboolean reconnect = FALSE;
|
||||||
const char *help_msg = "Run '" PACKAGE " --help' to see a full list of available command line options";
|
const char *help_msg = N_("Run '" PACKAGE " --help' to see a full list of available command line options");
|
||||||
const GOptionEntry options [] = {
|
const GOptionEntry options [] = {
|
||||||
{ "version", 'V', 0, G_OPTION_ARG_NONE, &print_version,
|
{ "version", 'V', 0, G_OPTION_ARG_NONE, &print_version,
|
||||||
"display version information", NULL },
|
N_("display version information"), NULL },
|
||||||
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
|
{ "verbose", 'v', 0, G_OPTION_ARG_NONE, &verbose,
|
||||||
"display verbose information", NULL },
|
N_("display verbose information"), NULL },
|
||||||
{ "direct", 'd', 0, G_OPTION_ARG_NONE, &direct,
|
{ "direct", 'd', 0, G_OPTION_ARG_NONE, &direct,
|
||||||
"direct connection with no automatic tunnels", NULL },
|
N_("direct connection with no automatic tunnels"), NULL },
|
||||||
{ "connect", 'c', 0, G_OPTION_ARG_STRING, &uri,
|
{ "connect", 'c', 0, G_OPTION_ARG_STRING, &uri,
|
||||||
"connect to hypervisor", "URI"},
|
N_("connect to hypervisor"), "URI"},
|
||||||
{ "wait", 'w', 0, G_OPTION_ARG_NONE, &waitvm,
|
{ "wait", 'w', 0, G_OPTION_ARG_NONE, &waitvm,
|
||||||
"wait for domain to start", NULL },
|
N_("wait for domain to start"), NULL },
|
||||||
{ "reconnect", 'r', 0, G_OPTION_ARG_NONE, &reconnect,
|
{ "reconnect", 'r', 0, G_OPTION_ARG_NONE, &reconnect,
|
||||||
"reconnect to domain upon restart", NULL },
|
N_("reconnect to domain upon restart"), NULL },
|
||||||
{ "debug", '\0', 0, G_OPTION_ARG_NONE, &debug,
|
{ "debug", '\0', 0, G_OPTION_ARG_NONE, &debug,
|
||||||
"display debugging information", NULL },
|
N_("display debugging information"), NULL },
|
||||||
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &args,
|
{ G_OPTION_REMAINING, '\0', 0, G_OPTION_ARG_STRING_ARRAY, &args,
|
||||||
NULL, "DOMAIN-NAME|ID|UUID" },
|
NULL, "DOMAIN-NAME|ID|UUID" },
|
||||||
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
|
{ NULL, 0, 0, G_OPTION_ARG_NONE, NULL, NULL, NULL }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
setlocale(LC_ALL, "");
|
||||||
|
bindtextdomain(GETTEXT_PACKAGE, LOCALE_DIR);
|
||||||
|
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
|
||||||
|
textdomain(GETTEXT_PACKAGE);
|
||||||
|
|
||||||
/* Setup command line options */
|
/* Setup command line options */
|
||||||
context = g_option_context_new ("- Virtual machine graphical console");
|
context = g_option_context_new (_("- Virtual machine graphical console"));
|
||||||
g_option_context_add_main_entries (context, options, NULL);
|
g_option_context_add_main_entries (context, options, NULL);
|
||||||
g_option_context_add_group (context, gtk_get_option_group (TRUE));
|
g_option_context_add_group (context, gtk_get_option_group (TRUE));
|
||||||
g_option_context_add_group (context, vnc_display_get_option_group ());
|
g_option_context_add_group (context, vnc_display_get_option_group ());
|
||||||
@ -76,7 +82,7 @@ int main(int argc, char **argv)
|
|||||||
if (error) {
|
if (error) {
|
||||||
g_print ("%s\n%s\n",
|
g_print ("%s\n%s\n",
|
||||||
error->message,
|
error->message,
|
||||||
help_msg);
|
gettext(help_msg));
|
||||||
g_error_free (error);
|
g_error_free (error);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -86,7 +92,7 @@ int main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!args || (g_strv_length(args) != 1)) {
|
if (!args || (g_strv_length(args) != 1)) {
|
||||||
fprintf(stderr, "\nUsage: %s [OPTIONS] DOMAIN-NAME|ID|UUID\n\n%s\n\n", argv[0], help_msg);
|
fprintf(stderr, _("\nUsage: %s [OPTIONS] DOMAIN-NAME|ID|UUID\n\n%s\n\n"), argv[0], help_msg);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user