qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: qemu-devel@nongnu.org
Cc: Anthony Liguori <aliguori@us.ibm.com>
Subject: [Qemu-devel] [PATCH 6/7] gtk: add translation support
Date: Wed,  5 Sep 2012 14:18:43 -0500	[thread overview]
Message-ID: <1346872724-9156-7-git-send-email-aliguori@us.ibm.com> (raw)
In-Reply-To: <1346872724-9156-1-git-send-email-aliguori@us.ibm.com>

This includes a de_DE translation from Kevin Wolf and an it translation from
Paolo Bonzini.

Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
---
 Makefile       |    3 +++
 configure      |    4 +++-
 po/Makefile    |   43 +++++++++++++++++++++++++++++++++++++++++++
 po/de_DE.po    |   37 +++++++++++++++++++++++++++++++++++++
 po/it.po       |   37 +++++++++++++++++++++++++++++++++++++
 po/messages.po |   37 +++++++++++++++++++++++++++++++++++++
 ui/gtk.c       |   20 ++++++++++++++------
 7 files changed, 174 insertions(+), 7 deletions(-)
 create mode 100644 po/Makefile
 create mode 100644 po/de_DE.po
 create mode 100644 po/it.po
 create mode 100644 po/messages.po

diff --git a/Makefile b/Makefile
index 9523e05..d75ef30 100644
--- a/Makefile
+++ b/Makefile
@@ -315,6 +315,9 @@ ifneq ($(BLOBS),)
 		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(qemu_datadir)"; \
 	done
 endif
+ifeq ($(CONFIG_GTK),y)
+	$(MAKE) -C po $@ || exit 1
+endif
 	$(INSTALL_DIR) "$(DESTDIR)$(qemu_datadir)/keymaps"
 	set -e; for x in $(KEYMAPS); do \
 		$(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(qemu_datadir)/keymaps"; \
diff --git a/configure b/configure
index 586dbd3..befc65c 100755
--- a/configure
+++ b/configure
@@ -3055,6 +3055,7 @@ fi
 
 qemu_confdir=$sysconfdir$confsuffix
 qemu_datadir=$datadir$confsuffix
+qemu_localedir="$datadir/locale"
 
 tools=
 if test "$softmmu" = yes ; then
@@ -3207,6 +3208,7 @@ echo "sysconfdir=$sysconfdir" >> $config_host_mak
 echo "qemu_confdir=$qemu_confdir" >> $config_host_mak
 echo "qemu_datadir=$qemu_datadir" >> $config_host_mak
 echo "qemu_docdir=$qemu_docdir" >> $config_host_mak
+echo "qemu_localedir=$qemu_localedir" >> $config_host_mak
 echo "libexecdir=\${prefix}/libexec" >> $config_host_mak
 echo "CONFIG_QEMU_HELPERDIR=\"$prefix/libexec\"" >> $config_host_mak
 
@@ -4135,7 +4137,7 @@ DIRS="$DIRS qapi-generated"
 DIRS="$DIRS libcacard libcacard/libcacard libcacard/trace"
 FILES="Makefile tests/tcg/Makefile qdict-test-data.txt"
 FILES="$FILES tests/tcg/cris/Makefile tests/tcg/cris/.gdbinit"
-FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile"
+FILES="$FILES tests/tcg/lm32/Makefile libcacard/Makefile po/Makefile"
 FILES="$FILES pc-bios/optionrom/Makefile pc-bios/keymaps"
 FILES="$FILES pc-bios/spapr-rtas/Makefile"
 FILES="$FILES roms/seabios/Makefile roms/vgabios/Makefile"
diff --git a/po/Makefile b/po/Makefile
new file mode 100644
index 0000000..0e2c11b
--- /dev/null
+++ b/po/Makefile
@@ -0,0 +1,43 @@
+# This makefile is very special as it's meant to build as part of the build
+# process and also within the source tree to update the translation files.
+
+VERSION=$(shell cat ../VERSION)
+TRANSLATIONS=de_DE
+SRCS=$(addsuffix .po, $(TRANSLATIONS))
+OBJS=$(addsuffix .mo, $(TRANSLATIONS))
+
+SRC_PATH=..
+
+-include ../config-host.mak
+
+vpath %.po $(SRC_PATH)/po
+
+all:
+	@echo Use 'make update' to update translation files
+	@echo or us 'make build' or 'make install' to build and install
+	@echo the translation files
+
+update: $(SRCS)
+
+build: $(OBJS)
+
+clean:
+	$(RM) $(OBJS)
+
+install: $(OBJS)
+	for obj in $(OBJS); do \
+	    base=`basename $$obj .mo`; \
+	    $(INSTALL) -d $(DESTDIR)$(prefix)/share/locale/$$base/LC_MESSAGES; \
+	    $(INSTALL) -m644 $$obj $(DESTDIR)$(prefix)/share/locale/$$base/LC_MESSAGES/qemu.mo; \
+	done
+
+%.mo:
+	@msgfmt -o $@ $(SRC_PATH)/po/`basename $@ .mo`.po
+
+messages.po: $(SRC_PATH)/ui/gtk.c
+	@xgettext -o $@ --foreign-user --package-name=QEMU --package-version=1.0.50 --msgid-bugs-address=qemu-devel@nongnu.org -k_ -C $<
+
+de_DE.po: messages.po $(SRC_PATH)/ui/gtk.c
+	@msgmerge $@ $< > $@.bak && mv $@.bak $@
+
+.PHONY: $(SRCS) clean all
diff --git a/po/de_DE.po b/po/de_DE.po
new file mode 100644
index 0000000..aa4ef42
--- /dev/null
+++ b/po/de_DE.po
@@ -0,0 +1,37 @@
+# SOME DESCRIPTIVE TITLE.
+# This file is put in the public domain.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: QEMU 1.0.50\n"
+"Report-Msgid-Bugs-To: qemu-devel@nongnu.org\n"
+"POT-Creation-Date: 2012-02-26 11:30-0600\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../ui/gtk.c:769
+msgid "_File"
+msgstr "_File FIXME"
+
+#: ../ui/gtk.c:779
+msgid "_View"
+msgstr "_View FIXME"
+
+#: ../ui/gtk.c:781
+msgid "_Full Screen"
+msgstr "_Full Screen FIXME"
+
+#: ../ui/gtk.c:805
+msgid "_Grab Input"
+msgstr "_Grab Input FIXME"
+
+#: ../ui/gtk.c:831
+msgid "Show _Tabs"
+msgstr "Show _Tabs FIXME"
diff --git a/po/it.po b/po/it.po
new file mode 100644
index 0000000..85eeef9
--- /dev/null
+++ b/po/it.po
@@ -0,0 +1,37 @@
+# Italian translation for QEMU.
+# This file is put in the public domain.
+# Paolo Bonzini <pbonzini@redhat.com>, 2012.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: QEMU 1.0.50\n"
+"Report-Msgid-Bugs-To: qemu-devel@nongnu.org\n"
+"POT-Creation-Date: 2012-02-26 11:30-0600\n"
+"PO-Revision-Date: 2012-02-27 08:23+0100\n"
+"Last-Translator: Paolo Bonzini <pbonzini@redhat.com>\n"
+"Language-Team: Italian <it@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+"Plural-Forms: nplurals=2; plural=n != 1;\n"
+
+#: ../ui/gtk.c:769
+msgid "_File"
+msgstr "_File"
+
+#: ../ui/gtk.c:779
+msgid "_View"
+msgstr "_Visualizza"
+
+#: ../ui/gtk.c:781
+msgid "_Full Screen"
+msgstr "_Schermo intero"
+
+#: ../ui/gtk.c:805
+msgid "_Grab Input"
+msgstr "_Cattura input"
+
+#: ../ui/gtk.c:831
+msgid "Show _Tabs"
+msgstr "Mostra _tab"
diff --git a/po/messages.po b/po/messages.po
new file mode 100644
index 0000000..741e782
--- /dev/null
+++ b/po/messages.po
@@ -0,0 +1,37 @@
+# SOME DESCRIPTIVE TITLE.
+# This file is put in the public domain.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: QEMU 1.0.50\n"
+"Report-Msgid-Bugs-To: qemu-devel@nongnu.org\n"
+"POT-Creation-Date: 2012-02-26 11:30-0600\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <LL@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../ui/gtk.c:769
+msgid "_File"
+msgstr ""
+
+#: ../ui/gtk.c:779
+msgid "_View"
+msgstr ""
+
+#: ../ui/gtk.c:781
+msgid "_Full Screen"
+msgstr ""
+
+#: ../ui/gtk.c:805
+msgid "_Grab Input"
+msgstr ""
+
+#: ../ui/gtk.c:831
+msgid "Show _Tabs"
+msgstr ""
diff --git a/ui/gtk.c b/ui/gtk.c
index 5a5d8e2..aa80ef4 100644
--- a/ui/gtk.c
+++ b/ui/gtk.c
@@ -31,8 +31,12 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
+#define GETTEXT_PACKAGE "qemu"
+#define LOCALEDIR "po"
+
 #include <gtk/gtk.h>
 #include <gdk/gdkkeysyms.h>
+#include <glib/gi18n.h>
 #include <vte/vte.h>
 #include <sys/types.h>
 #include <sys/socket.h>
@@ -940,7 +944,7 @@ static void gd_create_menus(GtkDisplayState *s)
     accel_group = gtk_accel_group_new();
     s->file_menu = gtk_menu_new();
     gtk_menu_set_accel_group(GTK_MENU(s->file_menu), accel_group);
-    s->file_menu_item = gtk_menu_item_new_with_mnemonic("_File");
+    s->file_menu_item = gtk_menu_item_new_with_mnemonic(_("_File"));
 
     s->quit_item = gtk_image_menu_item_new_from_stock(GTK_STOCK_QUIT, NULL);
     gtk_stock_lookup(GTK_STOCK_QUIT, &item);
@@ -950,9 +954,9 @@ static void gd_create_menus(GtkDisplayState *s)
 
     s->view_menu = gtk_menu_new();
     gtk_menu_set_accel_group(GTK_MENU(s->view_menu), accel_group);
-    s->view_menu_item = gtk_menu_item_new_with_mnemonic("_View");
+    s->view_menu_item = gtk_menu_item_new_with_mnemonic(_("_View"));
 
-    s->full_screen_item = gtk_check_menu_item_new_with_mnemonic("_Full Screen");
+    s->full_screen_item = gtk_check_menu_item_new_with_mnemonic(_("_Full Screen"));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->full_screen_item),
                                  "<QEMU>/View/Full Screen");
     gtk_accel_map_add_entry("<QEMU>/View/Full Screen", GDK_KEY_f, GDK_CONTROL_MASK | GDK_MOD1_MASK);
@@ -985,10 +989,10 @@ static void gd_create_menus(GtkDisplayState *s)
     separator = gtk_separator_menu_item_new();
     gtk_menu_append(GTK_MENU(s->view_menu), separator);
 
-    s->grab_on_hover_item = gtk_check_menu_item_new_with_mnemonic("Grab On _Hover");
+    s->grab_on_hover_item = gtk_check_menu_item_new_with_mnemonic(_("Grab On _Hover"));
     gtk_menu_append(GTK_MENU(s->view_menu), s->grab_on_hover_item);
 
-    s->grab_item = gtk_check_menu_item_new_with_mnemonic("_Grab Input");
+    s->grab_item = gtk_check_menu_item_new_with_mnemonic(_("_Grab Input"));
     gtk_menu_item_set_accel_path(GTK_MENU_ITEM(s->grab_item),
                                  "<QEMU>/View/Grab Input");
     gtk_accel_map_add_entry("<QEMU>/View/Grab Input", GDK_KEY_g, GDK_CONTROL_MASK | GDK_MOD1_MASK);
@@ -1014,7 +1018,7 @@ static void gd_create_menus(GtkDisplayState *s)
     separator = gtk_separator_menu_item_new();
     gtk_menu_append(GTK_MENU(s->view_menu), separator);
 
-    s->show_tabs_item = gtk_check_menu_item_new_with_mnemonic("Show _Tabs");
+    s->show_tabs_item = gtk_check_menu_item_new_with_mnemonic(_("Show _Tabs"));
     gtk_menu_append(GTK_MENU(s->view_menu), s->show_tabs_item);
 
     g_object_set_data(G_OBJECT(s->window), "accel_group", accel_group);
@@ -1051,6 +1055,10 @@ void gtk_display_init(DisplayState *ds)
     s->scale_y = 1.0;
     s->free_scale = FALSE;
 
+    setlocale(LC_ALL, "");
+    bindtextdomain("qemu", CONFIG_QEMU_LOCALEDIR);
+    textdomain("qemu");
+
     s->null_cursor = gdk_cursor_new(GDK_BLANK_CURSOR);
 
     s->mouse_mode_notifier.notify = gd_mouse_mode_change;
-- 
1.7.5.4

  parent reply	other threads:[~2012-09-05 19:19 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-05 19:18 [Qemu-devel] [PATCH 0/7] Add GTK UI to enable basic accessibility (v3) Anthony Liguori
2012-09-05 19:18 ` [Qemu-devel] [PATCH 1/7] console: allow VCs to be overridden by UI Anthony Liguori
2012-09-05 19:18 ` [Qemu-devel] [PATCH 2/7] ui: add basic GTK gui (v2) Anthony Liguori
2012-09-05 19:53   ` Blue Swirl
2012-09-05 20:00     ` Eric Blake
2012-09-05 20:38     ` Anthony Liguori
2012-09-05 21:00       ` Blue Swirl
2012-09-05 23:07         ` Anthony Liguori
2012-09-08  7:00           ` Blue Swirl
2012-09-05 20:04   ` Stefan Weil
2012-09-05 20:39     ` Anthony Liguori
2012-09-05 20:45     ` Jan Kiszka
2012-09-05 22:55       ` Anthony Liguori
2012-09-05 20:54   ` Jan Kiszka
2012-09-05 19:18 ` [Qemu-devel] [PATCH 3/7] gtk: add virtual console support (v2) Anthony Liguori
2012-09-05 19:18 ` [Qemu-devel] [PATCH 4/7] gtk: add support for input grabbing (v2) Anthony Liguori
2012-09-05 19:37   ` Jan Kiszka
2012-09-05 20:40     ` Anthony Liguori
2012-09-05 20:43       ` Jan Kiszka
2012-09-05 19:18 ` [Qemu-devel] [PATCH 5/7] gtk: add support for screen scaling and full screen (v3) Anthony Liguori
2012-09-05 19:18 ` Anthony Liguori [this message]
2012-09-06 12:18   ` [Qemu-devel] [PATCH 6/7] gtk: add translation support Kevin Wolf
2012-09-06 12:40     ` Anthony Liguori
2012-09-06 13:00   ` Peter Maydell
2012-09-05 19:18 ` [Qemu-devel] [PATCH 7/7] gtk: make default UI (v3) Anthony Liguori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1346872724-9156-7-git-send-email-aliguori@us.ibm.com \
    --to=aliguori@us.ibm.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).