[ruby-gnome2-doc-cvs] [Ruby-GNOME2 Project Website] update - tips_libglade_i18n

アーカイブの一覧に戻る

ruby-****@sourc***** ruby-****@sourc*****
2005年 8月 5日 (金) 13:43:37 JST


-------------------------
REMOTE_ADDR = 15.211.169.100
REMOTE_HOST = 
REMOTE_USER = ruby-gnome2-hiki
        URL = /hiki.cgi?tips_libglade_i18n
-------------------------
TITLE       = tips_libglade_i18n -> Supporting internationalization (i18n) in Ruby/Libglade
-------------------------
@@ -5,40 +5,26 @@
 This tutorial will show how to have Ruby/Libglade take advantage of gettext
 translated strings. For those of you unfamiliar with the concept of gettext,
 reading the ((<manual|URL:http://www.gnu.org/software/gettext/manual>)) is probably
-a good idea.
+a good idea. Also Ruby-GetText-Package has ((<an API referrence and tutorials|http://ponx.s5.xrea.com/hiki/ruby-gettext-dev.html>)).
 
-Before starting, make sure you have Ruby-GNOME2 installed.
+Before starting, make sure you have both of Ruby-GNOME2 and ((<Ruby-GetText-Package|http://ponx.s5.xrea.com/hiki/ruby-gettext.html>)) installed.
 
-While writing this tutorial, I used Ruby 1.8.1, Ruby-GNOME2 0.8.1 and gettext
-0.12.1 on a Gentoo Linux machine. There may be differences between versions
-that cause problems, so remember that if something doesn't work for you. I
-don't know if or how any of this works in Microsoft Windows. If anyone would like to
-contribute information regarding that, it'd be helpful.
-
-A lot of this information was obtained from the
-((<PyGTK FAQ|URL:http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq22.001.htp>)).
-
 == Creating the interface in Glade
 
 The first step is to create the interface with 'glade-2'. Every time you create
 a widget with a text field, the XML generated will have a 'translatable="yes"' 
 field added to it.
 
-Then go to Options->LibGlade Options and select 'Save Translatable Strings'. In
-the text field, insert a filename to save the strings in 'glade-msg.c' is a
-good one. The output is in a C-like format, because that is what xgettext will
-use.
-
 == Creating the translations
 
-((*Note*)) this section is heavily borrowed from the ((<PyGTK FAQ|URL:http://www.async.com.br/faq/pygtk/index.py?req=show&file=faq22.001.htp>)).
-mentioned above. I included this section so the reader doesn't have to jump around.
-
 Next you'll want to create the main translation file. To do this, use the following
 command:
 
-  xgettext -kN_ -o myapp.pot glade-msg.c
+  rgettext myapp.glade myapp.rb lib/lib.rb -o myapp.pot
 
+foo.glade is genereated by glade-2. myapp.rb and lib/lib.rb are the script files for your application  which you created.
+
+
 Look inside of this file. You should see the glade strings listed. 
 
 This .pot file should be sent to the translators. Once they get the file, they should
@@ -49,7 +35,-7 @@
 This will create de.po, where the translated strings should be entered. The translation
 file needs to be converted to a binary format before use:
 
-  msgfmt de.po -o myapp.mo
+  rmsgfmt de.po -o myapp.mo
 
 This file should then be placed in the appropriate directory. On my machine,
 this would go in /usr/share/locale/de/LC_MESSAGES/
@@ -72,6 +0,0 @@
   LANG=de_DE ruby myapp.rb
 
 The translated strings should appear. That's all there is to it.
+
+== Auto-generating the template file
+
+ruby-glade-create-template is a helper tool which creates a template script from a .glade file.
+
+ ruby-glade-create-template myapp.glade > myapp.rb
+
+Check myapp.rb. You can find GladeXML.new and signal handlers as the template.
 
 == Auto-generating the binary translation file
 
@@ -102,7 +96 @@
   Dir.glob("po/*/*.po") do |file|
       lang, basename = /po\/([\w\.]*)\/(.*)\.po/.match(file).to_a[1,2]
       FileUtils.mkdir_p modir % lang
-      system("msgfmt #{podir}#{lang}/#{basename}.po -o #{modir}#{basename}.mo" % lang)
+      system("rmsgfmt #{podir}#{lang}/#{basename}.po -o #{modir}#{basename}.mo" % lang)
   end
 
 You may also want to create the following pre-clean.rb:
@@ -135,6 +129,2 @@
 you have.
 
 == ChangeLog
+:2005-08-05 ((<Masao>))
+ Revised to use ruby-glade-create-package, rgettext and rmsgfmt.
 
 :2004-03-20 Zachary P. Landau
- Initial release
\ No newline at end of file
+ Initial release





ruby-gnome2-cvs メーリングリストの案内
アーカイブの一覧に戻る