Rails Engine localization with Ruby-GetText

Hi,

Recently, some people ask me for the l10n of
Engines with gettext.

So I wrote a HOWTO for it.
http://www.yotabanana.com/hiki/?ruby-gettext-howto-engines

And I localized login_engine for an example.
It includes English and Japanese messages.

http://www.yotabanana.com/hiki/?c=plugin;plugin=attach_download;p=ruby-gettext-howto-engines;file_name=login_engine_v1.0.2.gettext.tar.gz

HTH,

Masao M. wrote:

Hi,

Recently, some people ask me for the l10n of
Engines with gettext.

So I wrote a HOWTO for it.
http://www.yotabanana.com/hiki/?ruby-gettext-howto-engines

And I localized login_engine for an example.
It includes English and Japanese messages.

http://www.yotabanana.com/hiki/?c=plugin;plugin=attach_download;p=ruby-gettext-howto-engines;file_name=login_engine_v1.0.2.gettext.tar.gz

HTH,

hello masao-san,

i’m currently trying l10n with gettext and have 2 problems in my
application.

it looks like “rake updatepo” cannot find messages inside strings like
output << “

#{_(‘my localized message’)}

is this a bug? do i need a newer version (i’m currently using the
gettext-1.8.0-mswin32 gem)? or is it just me doing s.th. wrong?

and the second problem is that despite what language i want to enforce
via
GetText.locale = “fr_CH”
(right before init_gettext in the application controller)
it always seems to fall back to the HTTP_ACCEPT_LANGUAGE from the
browser :frowning:

any help would be greatly appreciated!

best regards
ralf

Hi,

On Fri, 12 Jan 2007 15:48:36 +0100
Ralf V. [email protected] wrote:

hello masao-san,

i’m currently trying l10n with gettext and have 2 problems in my
application.

it looks like “rake updatepo” cannot find messages inside strings like
output << “

#{_(‘my localized message’)}

is this a bug? do i need a newer version (i’m currently using the
gettext-1.8.0-mswin32 gem)? or is it just me doing s.th. wrong?

Hmm. OK.
I’ll try it. But I don’t know I can fix it.

Try this as work arround.

%s
” % _(‘my localized message’)

and the second problem is that despite what language i want to enforce
via
GetText.locale = “fr_CH”
(right before init_gettext in the application controller)
it always seems to fall back to the HTTP_ACCEPT_LANGUAGE from the
browser :frowning:

This may be a bug of 1.8.0.
Could you try CVS version ?

Masao M. wrote:

and the second problem is that despite what language i want to enforce
via
GetText.locale = “fr_CH”
(right before init_gettext in the application controller)
it always seems to fall back to the HTTP_ACCEPT_LANGUAGE from the
browser :frowning:

This may be a bug of 1.8.0.
Could you try CVS version ?

hi again,

tried now with 1.9.0 and it works! woohoo :slight_smile:

but something else…
today i read about the “haml” plugin for view templates (see
http://haml.hamptoncatlin.com).
which is really cool but gettext doesnt seem to get along with it at all
:frowning:

rake updatepo
Error: #<RubyLex::SyntaxError: unknown type of %string> in app/views/
test/test.haml:1
#content{:style=>‘padding:20px’}
rake aborted!

do you see any chances to support haml-templates in the near future?
i would really love to start using them, but without gettext support
it’d be a no-go.

best regards,
ralf