[Kde-bindings] Introducing project KDEgettext.rb for qtruby or korundum

David Palacio dpalacio at uninorte.edu.co
Mon Aug 17 16:25:56 UTC 2009


On Domingo 16 Agosto 2009 10:57:47 Robert Riemann escribió:
> Hi David,
> 
> Thanks for you testings.
> 
> > > Hi everyone,
> > >
> > > i wrote a little application to extract the translator information
> > >  (po-file) from your ruby code.
> > >
> > > You can find the gem on github and my own server (maybe github is to
> > > slow to show the recent commits):
> > >
> > > http://git.salout.selfip.org/KDEgettext.rb.git/tree
> > > http://github.com/saLOUt/KDEGettext.rb/tree
> > >
> > > But there is still one problem:
> > >
> > > On my PC the gem only works with ruby1.9 in a login console (su -
> > > user). It would be nice if you test it on your pc. I've uploaded some
> > > sample code to: http://pastie.org/572426
> > >
> > > After installation via sudo gem(1.9) install kdegettext.gem-x.x.x.gem
> > > there is a /usr/bin/kdegettext.rb .
> > >
> > > To use it with ruby v1.9 just try something like:
> > > ruby1.9 /usr/bin/kdegettext.rb file.rb
> > >
> > > to use it with your ruby in $PATH, it is only:
> > > kdegettext.rb file.rb
> > >
> > > I hope the bugs are related to my own ruby configuration.
> > >
> > > Greets Robert
> >
> > Hi,
> >
> > Thanks for your work. It works great! (tested on Debian, ruby1.8 as a
> > normal user).
> >
> > I notice it uses a number of rubygems, which are not available in my
> > distro as packages.
> 
> Actually all rubygems should be installed automatically via gem from the
> rubyforge.org server. As rubygems are not distro-specific there is no need
>  to provide distro packages, isn't it?
> 
Oh, I just downloaded from github and installed the dependencies (I do not use 
rubygems much). Also, I was thinking of packaging it together with korundum, 
and maybe making a CMake module (FindKorundum.cmake) that would give some 
helpers.

> > Another question: should context really be included in the msgid?
> 
> That's a known bug. I updated the online readme where the bug is already
> mentioned: http://korundum.rubyforge.org/kdegettext/README_rdoc.html
> 
> Workarounds (i need both tricks, maybe other need only one of them):
> - open a console an login via the following command: su - user
> - install kdegettext for ruby1.9: gem1.9 install kdegettext and use
>  kdegettext this way: ruby1.9 /usr/bin/kdegettext your_file.rb
> 
On a Debian/unstable chroot I install «gem install kdegettext». It initially 
fails with:
/var/lib/gems/1.8/gems/locale-2.0.4/lib/locale.rb:239:in `collect_candidates': 
undefined method `size' for nil:NilClass (NoMethodError)
        from /var/lib/gems/1.8/gems/locale-2.0.4/lib/locale.rb:222:in 
`candidates'
        from 
/var/lib/gems/1.8/gems/gettext-2.0.4/lib/gettext/textdomain_manager.rb:79:in 
`each_textdomains'
        from 
/var/lib/gems/1.8/gems/gettext-2.0.4/lib/gettext/textdomain_manager.rb:102:in 
`translate_singluar_message'
        from /var/lib/gems/1.8/gems/gettext-2.0.4/lib/gettext.rb:130:in `_'
        from 
/var/lib/gems/1.8/gems/gettext-2.0.4/lib/gettext/tools/rgettext.rb:190:in 
`check_options'
        from 
/var/lib/gems/1.8/gems/gettext-2.0.4/lib/gettext/tools/rgettext.rb:233:in 
`run'
        from 
/var/lib/gems/1.8/gems/gettext-2.0.4/lib/gettext/tools/rgettext.rb:263:in 
`rgettext'
        from /var/lib/gems/1.8/gems/kdegettext-0.9.3/bin/kdegettext.rb:279
        from /var/lib/gems/1.8/bin/kdegettext.rb:19:in `load'
        from /var/lib/gems/1.8/bin/kdegettext.rb:19


after I do «su - root», it works and context is correctly separated. Note: I 
did not need ruby1.9, nor fullpaths, just su -.

Back to my setup, Debian Lenny, ruby1.8.7. It works without «su - user», with 
the context bug. gettext-ruby came from Debian packages (ver. 1.91.0-1.2).

I removed the debian package and installed the gem one (ver 2.0.4). Now I get 
the previous backtrace and «su - user» fixes it. So, the problem may be in 
ruby-gettext version 2.

> It would be nice if you could test which one (maybe both) of these work-
> arounds would really necessary for you.
> 
> > Output for the first file in the pastie:
> > =====================
> > # 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 at ADDRESS>, YEAR.
> > #
> > #, fuzzy
> > msgid ""
> > msgstr ""
> > "Project-Id-Version: PACKAGE VERSION\n"
> > "POT-Creation-Date: 2009-08-15 19:01-0500\n"
> > "PO-Revision-Date: 2009-08-15 19:01-0500\n"
> > "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
> > "Language-Team: LANGUAGE <LL at li.org>\n"
> > "MIME-Version: 1.0\n"
> > "Content-Type: text/plain; charset=UTF-8\n"
> > "Content-Transfer-Encoding: 8bit\n"
> > "Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
> >
> > #: test1.rb:20
> > msgid "after one Test"
> > msgid_plural "after %1 Tests"
> > msgstr[0] ""
> > msgstr[1] ""
> >
> > #: test1.rb:16
> > msgid "contextTest %1"
> > msgstr ""
> >
> > #: test1.rb:14 test1.rb:22
> > msgid "Test without context %1"
> > msgstr ""
> >
> > #: test1.rb:18
> > msgid "contextafter one Test with context"
> > msgid_plural "after %1 Tests with context"
> > msgstr[0] ""
> > msgstr[1] ""
> >
> > #: test1.rb:7
> > msgid "i18nQtRuby"
> 



More information about the Kde-bindings mailing list