GetText: Works with en_GB and en_US, but doesn't with de_DE!

Hi all

I’m trying to get GetText to work. I have the following folder
structure:

|-myapp.pot
|-de_DE/:
| -myapp.po |-en_GB/: |-myapp.po
|-en_US/:
-myapp.po

I run rake updatepo, and then rake makemo.

Now I set en-gb as default language in Firefox and run my app >> works!
Then I set en-us as default language in Firefox and run my app >> works,
too!
Last but not least I set de-de as default language in Firefox and run my
app >> Failure!

NoMethodError in Member#register

You have a nil object when you didn’t expect it!
The error occured while evaluating nil.unpack


RAILS_ROOT: script/…/config/…
Application Trace | Framework Trace | Full Trace

/usr/lib/ruby/gems/1.8/gems/gettext-1.1.0/lib/gettext/mo.rb:66:in
load_from_stream' /usr/lib/ruby/gems/1.8/gems/gettext-1.1.0/lib/gettext/mo.rb:229:inload_from_file’
/usr/lib/ruby/gems/1.8/gems/gettext-1.1.0/lib/gettext/mo.rb:229:in
open' /usr/lib/ruby/gems/1.8/gems/gettext-1.1.0/lib/gettext/mo.rb:229:inload_from_file’
/usr/lib/ruby/gems/1.8/gems/gettext-1.1.0/lib/gettext/mo.rb:38:in `open’

What’s the problem?? I just don’t get it to work… Any help is very
appreciated. :slight_smile:

Btw. how can I set a default language, so if the default language of the
browser is not supported it displays the page e.g. in german?

Thanks a lot.
Josh

OK I just found out, that when I set “Arabic/Qatar” (ar-qa) as default
language then the app works well and displays the stuff that I have
written originally in the rhtml files with the _() function.
So when a language is not supported, then it displays me this default
stuff, right?

So far, so good - the de_DE still does not work… :-/

Hi,

On Wed, 11 Jan 2006 14:11:15 +0100
Joshua M. [email protected] wrote:

OK I just found out, that when I set “Arabic/Qatar” (ar-qa) as default
language then the app works well and displays the stuff that I have
written originally in the rhtml files with the _() function.
So when a language is not supported, then it displays me this default
stuff, right?

Right.

So far, so good - the de_DE still does not work… :-/

Send me your whole application, if you can.

I’ll investigate it.

Hi,

On Wed, 11 Jan 2006 14:40:58 +0100
Joshua M. [email protected] wrote:

Send me your whole application, if you can.

I’ll investigate it.

Thanks. Where can I send it to?

To me. [email protected].

Now I set en-gb as default language in Firefox and run my app >> works!
Then I set en-us as default language in Firefox and run my app >> works,
too!
Last but not least I set de-de as default language in Firefox and run my
app >> Failure!

I had similar problem but I didn’t get any error message so your problem
might be different. Anyway make sure that your server has de_DE locales
installed. Check this with “locale -a” command, if not then install
them. There is no info about this at Ruby gettext page.

Send me your whole application, if you can.

I’ll investigate it.

Thanks. Where can I send it to?

Hi,

On Thu, 9 Feb 2006 13:57:07 +0100
Grzegorz D. [email protected] wrote:

Now I set en-gb as default language in Firefox and run my app >> works!
Then I set en-us as default language in Firefox and run my app >> works,
too!
Last but not least I set de-de as default language in Firefox and run my
app >> Failure!

I had similar problem but I didn’t get any error message so your problem
might be different. Anyway make sure that your server has de_DE locales
installed. Check this with “locale -a” command, if not then install
them. There is no info about this at Ruby gettext page.

Ruby-GetText-Package doesn’t depend on the system locale.
If you have a translated po file in po/#{lang}/ correctly,
it will be shown the language even if your server doesn’t support your
locale.

Anyway, I investigated his program …
And in his case, he didn’t translate po/de_DE/hisapp.po,
so English was shown :wink:

Ruby-GetText-Package doesn’t depend on the system locale.
If you have a translated po file in po/#{lang}/ correctly,
it will be shown the language even if your server doesn’t support your
locale.

OK I understand. I guess that there is something wrong with my gettext
package configuration. Please look below, I execute the hello.rb
example:

greg@gdcomp:~/tmp/samples$ ls locale/
cs de el es fr it ja ko nl pt_BR sv

greg@gdcomp:~/tmp/samples$ LC_ALL=de_DE.utf8 ruby hello.rb
Hallo Welt
greg@gdcomp:~/tmp/samples$ LC_ALL=ko_KR.utf8 ruby hello.rb
Hello World
greg@gdcomp:~/tmp/samples$ LC_ALL=sv_SE.utf8 ruby hello.rb
Hello World
greg@gdcomp:~/tmp/samples$ LC_ALL=sv_FI.utf8 ruby hello.rb
Hello World
greg@gdcomp:~/tmp/samples$ LC_ALL=cs_CZ.utf8 ruby hello.rb
Ahoj SvÄ?te

greg@gdcomp:~/tmp/samples$ locale -a
C
cs_CZ.utf8
de_DE.utf8
en_US.utf8
es_ES.utf8
fr_FR.utf8
hu_HU.utf8
it_IT.utf8
ja_JP.utf8
pl_PL.utf8
POSIX
pt_PT.utf8
ru_RU.utf8
zh_CN.utf8

after adding ko_KR.UTF-8 UTF-8 to /etc/locale.gen and executing
locale-gen (Ubuntu 5.10 linux disto)
greg@gdcomp:~/tmp/samples$ LC_ALL=ko_KR.utf8 ruby hello.rb
ì??ë?? ì?¸ì?

Works. I guess that there is a different way of changing a lang to use
by hello example.

Regards,
GD

Hi,

On Thu, 9 Feb 2006 14:47:48 +0100
Grzegorz D. [email protected] wrote:

Ruby-GetText-Package doesn’t depend on the system locale.
If you have a translated po file in po/#{lang}/ correctly,
it will be shown the language even if your server doesn’t support your
locale.

OK I understand. I guess that there is something wrong with my gettext
package configuration. Please look below, I execute the hello.rb

Works. I guess that there is a different way of changing a lang to use
by hello example.

Ah, I see.

Ruby-GetText-Package depends on system locale if you use it on the
console.

But “gettext/rails” doesn’t depend on system locale.
#Because the information is from the www browser(not server side).

Here is Rails ML, so I answered the behavior of it on Rails.

P.S.
If you’re interested in it, check gettext/cgi.rb.
And the url below may help you:
http://www.yotabanana.com/hiki/ruby-gettext-howto-cgi.html#How+to+get+the+locale+information+from+WWW+browser