diff options
author | Daniel P. Berrange <berrange@redhat.com> | 2010-01-11 16:01:20 +0000 |
---|---|---|
committer | Daniel P. Berrange <berrange@redhat.com> | 2010-01-11 16:01:20 +0000 |
commit | 50f48b4d912c61d086212dd8d39f4020fa105916 (patch) | |
tree | 0825043576b1db3df1ea5707caac7d2b69f1583f | |
parent | acf61455a347571a66ec6db18c9f0aa1e6f7441d (diff) |
Add support for i18n of the UI
Add all the boilerplate code required for doing i18n of the UI.
No translations available yet though
-rw-r--r-- | .hgignore | 13 | ||||
-rw-r--r-- | Makefile.am | 21 | ||||
-rwxr-xr-x | autogen.sh | 5 | ||||
-rw-r--r-- | configure.ac | 9 | ||||
-rw-r--r-- | intltool-extract.in | 0 | ||||
-rw-r--r-- | intltool-merge.in | 0 | ||||
-rw-r--r-- | intltool-update.in | 0 | ||||
-rw-r--r-- | po/LINGUAS | 0 | ||||
-rw-r--r-- | po/POTFILES.in | 8 | ||||
-rw-r--r-- | src/Makefile.am | 3 | ||||
-rw-r--r-- | src/main.c | 32 |
11 files changed, 72 insertions, 19 deletions
@@ -22,6 +22,7 @@ Makefile\.in$ ^src/Makefile$ ^stamp-h1$ ^virt-viewer\.spec$ +^mingw32-virt-viewer\.spec$ ^config.h.in$ ^man/Makefile$ ^man/virt-viewer\.1$ @@ -32,3 +33,15 @@ Makefile\.in$ ^plugin/.*\.so ^plugin/.*\.lo ^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$ diff --git a/Makefile.am b/Makefile.am index e560111..f63cb0d 100644 --- a/Makefile.am +++ b/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 libtoolize --copy --force -aclocal +intltoolize --force +aclocal -I m4 autoheader -automake --add-missing +automake --add-missing --copy autoconf cd $THEDIR diff --git a/configure.ac b/configure.ac index 79cad96..d39846d 100644 --- a/configure.ac +++ b/configure.ac @@ -16,6 +16,14 @@ AC_DEFINE([_GNU_SOURCE], [], [Enable GNU extensions]) 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(LIBVIRT, libvirt >= 0.6.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 src/Makefile man/Makefile + po/Makefile.in plugin/Makefile virt-viewer.spec mingw32-virt-viewer.spec) diff --git a/intltool-extract.in b/intltool-extract.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/intltool-extract.in diff --git a/intltool-merge.in b/intltool-merge.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/intltool-merge.in diff --git a/intltool-update.in b/intltool-update.in new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/intltool-update.in 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..0649f8e --- /dev/null +++ b/po/POTFILES.in @@ -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 diff --git a/src/Makefile.am b/src/Makefile.am index 69a725d..70525f6 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -27,4 +27,5 @@ virt_viewer_CFLAGS = \ @LIBGLADE2_CFLAGS@ \ @LIBVIRT_CFLAGS@ \ @WARN_CFLAGS@ \ - -DGLADE_DIR="\"$(gladedir)\"" + -DGLADE_DIR="\"$(gladedir)\"" \ + -DLOCALE_DIR=\""$(datadir)/locale"\" @@ -21,15 +21,16 @@ */ #include <config.h> - +#include <locale.h> #include <vncdisplay.h> #include <gtk/gtk.h> +#include <glib/gi18n.h> #include "viewer.h" 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 waitvm = 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 [] = { { "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, - "display verbose information", NULL }, + N_("display verbose information"), NULL }, { "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 to hypervisor", "URI"}, + N_("connect to hypervisor"), "URI"}, { "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 to domain upon restart", NULL }, + N_("reconnect to domain upon restart"), NULL }, { "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, NULL, "DOMAIN-NAME|ID|UUID" }, { 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 */ - 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_group (context, gtk_get_option_group (TRUE)); g_option_context_add_group (context, vnc_display_get_option_group ()); @@ -76,7 +82,7 @@ int main(int argc, char **argv) if (error) { g_print ("%s\n%s\n", error->message, - help_msg); + gettext(help_msg)); g_error_free (error); return 1; } @@ -86,7 +92,7 @@ int main(int argc, char **argv) } 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; } |