Re: A question about translations

Daichi Kawahata <[email protected]> Sun, 19 Mar 2006 13:31:21 +0900
Newsgroups gmane.comp.desktop.xfce.goodies.devel
Message-ID <[email protected]>
On Sat, 18 Mar 2006 02:48:45 +0200
Alexander Iliev wrote:

> Hi.

Hi,

> I finally decided to add translation support to
> xfce4-xkb-plugin, but I ran into some problems.

(snip)

> The bg.mo file installed properly in
> $PREFIX/share/locale/bg/LC_MESSAGES/xfce4-xkb-plugin.mo.
> 
> Unfortunately the messages remained in english, so
> my question is - how can I check what went wrong and
> why the translation does not load?
> 
> btw, the .desktop file translation works fine - the name
> and comment for the plugin appear in bulgarian in the
> plugin add dialog.

Really sorry, I've modified them for i18n support without
letting you know, and it should work in rev. 1177.

FYI, I'll attach the patch (xfce4-xkb-plugin.patch),
screen shot (xfce4-xkb-plugin.jpg), guess the problem
was the order of `config.h' in the xfce4-xkb-plugin.c
(xfce4-xkb-plugin.c.patch).

Regards,
-- 
Daichi

Language Codes: http://www.w3.org/WAI/ER/IG/ert/iso639.htm
Country Codes: http://www.ics.uci.edu/pub/ietf/http/related/iso3166.txt
xfce4-xkb-plugin.patch (text/x-patch, 8.8 KB)
Index: Makefile.am
===================================================================
--- Makefile.am	(revision 1173)
+++ Makefile.am	(working copy)
@@ -1,9 +1,12 @@
 @SET_MAKE@
 
-SUBDIRS = panel-plugin flags
+SUBDIRS = panel-plugin flags po
 
 EXTRA_DIST =								\
-	README
+	README								\
+	intltool-extract.in						\
+	intltool-merge.in						\
+	intltool-update.in
 
 distclean-local:
 	rm -rf *.cache *~
Index: configure.ac
===================================================================
--- configure.ac	(revision 1173)
+++ configure.ac	(working copy)
@@ -29,6 +29,7 @@
 AC_PROG_CC
 AC_PROG_INSTALL
 AC_PROG_LIBTOOL
+AC_PROG_INTLTOOL
 
 dnl Check for X11
 XDT_CHECK_LIBX11_REQUIRE
@@ -36,6 +37,9 @@
 dnl configure the panel plugin
 XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.3.20])
 
+dnl Check for i18n support
+XDT_I18N([bg ja])
+
 dnl check for debugging support
 XDT_FEATURE_DEBUG()
 
@@ -43,4 +47,5 @@
 panel-plugin/Makefile
 flags/Makefile
 Makefile
+po/Makefile.in
 ])
Index: panel-plugin/Makefile.am
===================================================================
--- panel-plugin/Makefile.am	(revision 1173)
+++ panel-plugin/Makefile.am	(working copy)
@@ -9,25 +9,27 @@
 
 xfce4_xkb_plugin_CFLAGS =									\
 	@LIBXFCE4PANEL_CFLAGS@          				\
+	-DPACKAGE_LOCALE_DIR=\"$(localedir)\"				\
 	-DFLAGSDIR=\"$(datadir)/xfce4/xkb/flags\"
 
 xfce4_xkb_plugin_LDADD = 									\
 	@LIBXFCE4PANEL_LIBS@										\
 	@LIBS@
 
-desktop_in_files = xkb-plugin.desktop.in
-desktop_files = $(desktop_in_files:.desktop.in=.desktop)
+desktop_in_in_files = xkb-plugin.desktop.in.in
+desktop_in_files = $(desktop_in_in_files:.desktop.in.in=.desktop.in)
 
 desktopdir = $(datadir)/xfce4/panel-plugins
-desktop_DATA = $(desktop_files)
+desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
+@INTLTOOL_DESKTOP_RULE@
 
 EXTRA_DIST =															\
-	$(desktop_in_files)
+	$(desktop_in_in_files)
 
 DISTCLEANFILES = 													\
 	$(desktop_DATA) $(desktop_in_files)
 
-%.desktop: %.desktop.in
+%.desktop.in: %.desktop.in.in
 	sed -e "s^@PLUGIN_PATH@^$(libexecdir)/xfce4/panel-plugins^" \
 		$< > $@
 
Index: panel-plugin/xkb-plugin.desktop.in
===================================================================
--- panel-plugin/xkb-plugin.desktop.in	(revision 1173)
+++ panel-plugin/xkb-plugin.desktop.in	(working copy)
@@ -1,8 +0,0 @@
-[Xfce Panel]
-Type=X-XFCE-PanelPlugin
-Encoding=UTF-8
-Name=Keyboard Layout Switcher
-Comment=Displays the current keyboard layout and switches the layout when clicked
-Icon=gnome-dev-keyboard
-X-XFCE-Exec=@PLUGIN_PATH@/xfce4-xkb-plugin
-X-XFCE-Unique=TRUE
Index: panel-plugin/xkb-plugin.desktop.in.in
===================================================================
--- panel-plugin/xkb-plugin.desktop.in.in	(revision 0)
+++ panel-plugin/xkb-plugin.desktop.in.in	(revision 0)
@@ -0,0 +1,8 @@
+[Xfce Panel]
+Type=X-XFCE-PanelPlugin
+Encoding=UTF-8
+_Name=Keyboard Layout Switcher
+_Comment=Displays the current keyboard layout and switches the layout when clicked
+Icon=gnome-dev-keyboard
+X-XFCE-Exec=@PLUGIN_PATH@/xfce4-xkb-plugin
+X-XFCE-Unique=TRUE
Index: po/ChangeLog
===================================================================
--- po/ChangeLog	(revision 0)
+++ po/ChangeLog	(revision 0)
@@ -0,0 +1,4 @@
+2006-03-19  Daichi Kawahata <[email protected]>
+
+	* ChangeLog, POTFILES.in, bg.po, ja.po, xfce4-xkb-plugin.pot:
+	  Initial import for i18n support.
Index: po/POTFILES.in
===================================================================
--- po/POTFILES.in	(revision 0)
+++ po/POTFILES.in	(revision 0)
@@ -0,0 +1,6 @@
+# List of source files containing translatable strings.
+
+panel-plugin/xfce4-xkb-plugin.c
+
+# files added by intltool-prepare.
+panel-plugin/xkb-plugin.desktop.in.in
Index: po/bg.po
===================================================================
--- po/bg.po	(revision 0)
+++ po/bg.po	(revision 0)
@@ -0,0 +1,53 @@
+# Bulgarian translations for xfce4-xkb-plugin package.
+# Copyright (C) 2004-2006 Alexander Iliev.
+# This file is distributed under the same license as the xfce4-xkb-plugin package.
+# Alexander Iliev <[email protected]>, 2006.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: xfce4-xkb-plugin 0.4.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2006-03-19 12:50+0900\n"
+"PO-Revision-Date: 2006-03-19 12:01+0900\n"
+"Last-Translator: Alexander Iliev <[email protected]>\n"
+"Language-Team: Bulgarian <[email protected]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:410
+msgid "Configure Keyboard Layout Switcher"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:423
+msgid "Show layout as"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:438
+msgid "image"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:439
+msgid "text"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:443
+msgid "Per applcation settings"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:457
+msgid "_Remember layout for each application"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:466
+msgid "Default layout:"
+msgstr ""
+
+#: ../panel-plugin/xkb-plugin.desktop.in.in.h:1
+msgid ""
+"Displays the current keyboard layout and switches the layout when clicked"
+msgstr ""
+
+#: ../panel-plugin/xkb-plugin.desktop.in.in.h:2
+msgid "Keyboard Layout Switcher"
+msgstr ""
Index: po/ja.po
===================================================================
--- po/ja.po	(revision 0)
+++ po/ja.po	(revision 0)
@@ -0,0 +1,54 @@
+# Japanese translations for xfce4-xkb-plugin package.
+# Copyright (C) 2004-2006 Alexander Iliev.
+# This file is distributed under the same license as the xfce4-xkb-plugin package.
+# Daichi Kawahata <[email protected]>, 2006.
+#
+msgid ""
+msgstr ""
+"Project-Id-Version: xfce4-xkb-plugin 0.4.0\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2006-03-19 12:50+0900\n"
+"PO-Revision-Date: 2006-03-19 13:04+0900\n"
+"Last-Translator: Daichi Kawahata <[email protected]>\n"
+"Language-Team: Japanese <[email protected]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=UTF-8\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:410
+msgid "Configure Keyboard Layout Switcher"
+msgstr "キーボードレイアウト切り換えの設定"
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:423
+msgid "Show layout as"
+msgstr "レイアウトの表示方法"
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:438
+msgid "image"
+msgstr "画像"
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:439
+msgid "text"
+msgstr "文字"
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:443
+msgid "Per applcation settings"
+msgstr "アプリケーション毎の設定"
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:457
+msgid "_Remember layout for each application"
+msgstr "アプリケーション毎のレイアウトを覚えておく(_R)"
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:466
+msgid "Default layout:"
+msgstr "標準レイアウト:"
+
+#: ../panel-plugin/xkb-plugin.desktop.in.in.h:1
+msgid ""
+"Displays the current keyboard layout and switches the layout when clicked"
+msgstr ""
+"現在のキーボードレイアウトを表示、クリックでそのレイアウトを切り換えます。"
+
+#: ../panel-plugin/xkb-plugin.desktop.in.in.h:2
+msgid "Keyboard Layout Switcher"
+msgstr "キーボードレイアウトの切り換え"
Index: po/xfce4-xkb-plugin.pot
===================================================================
--- po/xfce4-xkb-plugin.pot	(revision 0)
+++ po/xfce4-xkb-plugin.pot	(revision 0)
@@ -0,0 +1,54 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the PACKAGE package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: PACKAGE VERSION\n"
+"Report-Msgid-Bugs-To: \n"
+"POT-Creation-Date: 2006-03-19 12:50+0900\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <[email protected]>\n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:410
+msgid "Configure Keyboard Layout Switcher"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:423
+msgid "Show layout as"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:438
+msgid "image"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:439
+msgid "text"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:443
+msgid "Per applcation settings"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:457
+msgid "_Remember layout for each application"
+msgstr ""
+
+#: ../panel-plugin/xfce4-xkb-plugin.c:466
+msgid "Default layout:"
+msgstr ""
+
+#: ../panel-plugin/xkb-plugin.desktop.in.in.h:1
+msgid ""
+"Displays the current keyboard layout and switches the layout when clicked"
+msgstr ""
+
+#: ../panel-plugin/xkb-plugin.desktop.in.in.h:2
+msgid "Keyboard Layout Switcher"
+msgstr ""
xfce4-xkb-plugin.jpg (image/jpeg, 15.1 KB) - not displayed
xfce4-xkb-plugin.c.patch (text/x-patch, 404 B)
Index: xfce4-xkb-plugin.c
===================================================================
--- xfce4-xkb-plugin.c	(revision 1177)
+++ xfce4-xkb-plugin.c	(working copy)
@@ -12,12 +12,12 @@
 //====================================================================
 */
 
-#include "xkb.h"
-
 #ifdef HAVE_CONFIG_H
 #include <config.h>
 #endif
 
+#include "xkb.h"
+
 #include <stdio.h>
 #include <ctype.h>