From patchwork Sun Feb 26 23:46:34 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anthony Liguori X-Patchwork-Id: 143137 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 6E002B6FBD for ; Mon, 27 Feb 2012 10:59:52 +1100 (EST) Received: from localhost ([::1]:48096 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1noQ-0003WL-F8 for incoming@patchwork.ozlabs.org; Sun, 26 Feb 2012 18:47:30 -0500 Received: from eggs.gnu.org ([208.118.235.92]:38937) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1no3-0002WQ-Mg for qemu-devel@nongnu.org; Sun, 26 Feb 2012 18:47:09 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S1no1-00079X-Rd for qemu-devel@nongnu.org; Sun, 26 Feb 2012 18:47:07 -0500 Received: from cpe-70-123-132-139.austin.res.rr.com ([70.123.132.139]:37509 helo=localhost6.localdomain6) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S1no1-00079S-KO for qemu-devel@nongnu.org; Sun, 26 Feb 2012 18:47:05 -0500 Received: from localhost6.localdomain6 (localhost.localdomain [127.0.0.1]) by localhost6.localdomain6 (8.14.4/8.14.4/Debian-2ubuntu1) with ESMTP id q1QNl3D0009026; Sun, 26 Feb 2012 17:47:03 -0600 Received: (from anthony@localhost) by localhost6.localdomain6 (8.14.4/8.14.4/Submit) id q1QNl1Hr009025; Sun, 26 Feb 2012 17:47:01 -0600 From: Anthony Liguori To: qemu-devel@nongnu.org Date: Sun, 26 Feb 2012 17:46:34 -0600 Message-Id: <1330299995-8688-8-git-send-email-aliguori@us.ibm.com> X-Mailer: git-send-email 1.7.4.1 In-Reply-To: <1330299995-8688-1-git-send-email-aliguori@us.ibm.com> References: <1330299995-8688-1-git-send-email-aliguori@us.ibm.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 70.123.132.139 Cc: Kevin Wolf , Stefan Weil , Anthony Liguori , Alex Graf , Paolo Bonzini Subject: [Qemu-devel] [PATCH 7/8] gtk: add translation support X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The de_DE translation is just a placeholder so that I could test the infrastructure. Signed-off-by: Anthony Liguori --- Makefile | 3 +++ configure | 4 ++++ po/Makefile | 43 +++++++++++++++++++++++++++++++++++++++++++ po/de_DE.po | 37 +++++++++++++++++++++++++++++++++++++ po/messages.po | 37 +++++++++++++++++++++++++++++++++++++ ui/gtk.c | 18 +++++++++++++----- 6 files changed, 137 insertions(+), 5 deletions(-) create mode 100644 po/Makefile create mode 100644 po/de_DE.po create mode 100644 po/messages.po diff --git a/Makefile b/Makefile index aa758dd..d8f33f7 100644 --- a/Makefile +++ b/Makefile @@ -296,6 +296,9 @@ ifneq ($(BLOBS),) $(INSTALL_DATA) $(SRC_PATH)/pc-bios/$$x "$(DESTDIR)$(datadir)"; \ done endif +ifeq ($(CONFIG_GTK),y) + $(MAKE) -C po $@ || exit 1 +endif $(INSTALL_DIR) "$(DESTDIR)$(datadir)/keymaps" set -e; for x in $(KEYMAPS); do \ $(INSTALL_DATA) $(SRC_PATH)/pc-bios/keymaps/$$x "$(DESTDIR)$(datadir)/keymaps"; \ diff --git a/configure b/configure index 4c80673..7d5cb38 100755 --- a/configure +++ b/configure @@ -3916,6 +3916,10 @@ if [ "$source_path" != `pwd` ]; then mkdir -p libcacard rm -f libcacard/Makefile symlink "$source_path/libcacard/Makefile" libcacard/Makefile + + mkdir -p po + rm -f po/Makefile + symlink "$source_path/po/Makefile" po/Makefile fi d=libuser 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 , 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 \n" +"Language-Team: LANGUAGE \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/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 , 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 \n" +"Language-Team: LANGUAGE \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 578cb94..5b759bc 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 #include +#include #include #include #include @@ -772,7 +776,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); @@ -782,9 +786,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), "/View/Full Screen"); gtk_accel_map_add_entry("/View/Full Screen", GDK_KEY_f, GDK_CONTROL_MASK | GDK_MOD1_MASK); @@ -808,7 +812,7 @@ static void gd_create_menus(GtkDisplayState *s) separator = gtk_separator_menu_item_new(); gtk_menu_append(GTK_MENU(s->view_menu), separator); - 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), "/View/Grab Input"); gtk_accel_map_add_entry("/View/Grab Input", GDK_KEY_g, GDK_CONTROL_MASK | GDK_MOD1_MASK); @@ -834,7 +838,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); @@ -870,6 +874,10 @@ void gtk_display_init(DisplayState *ds) s->scale_x = 1.0; s->scale_y = 1.0; + setlocale(LC_ALL, ""); + bindtextdomain("qemu", CONFIG_QEMU_PREFIX "/share/locale"); + textdomain("qemu"); + s->null_cursor = gdk_cursor_new(GDK_BLANK_CURSOR); s->mouse_mode_notifier.notify = gd_mouse_mode_change;