Forum: Rails I18n Script to extract text from application

Bc78ecf1898c83d627f9779e0e47af15?d=identicon&s=25 Carsten Gehling (carsten)
on 2009-01-03 18:25
I accidentally posted this question in the Rails forum, but it might fit
better here...

I have a Rails application, that has grown quite large. At the moment
all texts are placed inside the template files like this:

<h3>This is a header</h3>

And inside the ruby code (like flash messages, model error messages,
etc.)

I now have the situation, that I want to place all text in an external
textfile in order to be able to e.g. translate the entire site.

Is there an easy way to extract all these texts and replace them with
e.g.

l(:some_text_key) in the ruby code and

<%=l(:some_text_key) in the templates?

or do I have to go through all files manually? (yikes)

BTW: I will happily move to Rails 2.2 if that is any help.

- Carsten
1637fd44c209e4fe8704b289d6c7e390?d=identicon&s=25 Zigzag Chen (zigzag)
on 2010-01-02 16:38
Check out the ready_for_i18n tool at
http://github.com/zigzag/ready_for_i18n

An introduction blog at:
http://zigzag.github.com/2009/12/17/get-your-local...

Carsten Gehling wrote:
> I accidentally posted this question in the Rails forum, but it might fit
> better here...
>
> I have a Rails application, that has grown quite large. At the moment
> all texts are placed inside the template files like this:
>
> <h3>This is a header</h3>
>
> And inside the ruby code (like flash messages, model error messages,
> etc.)
>
> I now have the situation, that I want to place all text in an external
> textfile in order to be able to e.g. translate the entire site.
>
> Is there an easy way to extract all these texts and replace them with
> e.g.
>
> l(:some_text_key) in the ruby code and
>
> <%=l(:some_text_key) in the templates?
>
> or do I have to go through all files manually? (yikes)
>
> BTW: I will happily move to Rails 2.2 if that is any help.
>
> - Carsten
Bc78ecf1898c83d627f9779e0e47af15?d=identicon&s=25 Carsten Gehling (carsten)
on 2010-01-02 18:22
Zigzag Chen wrote:
> Check out the ready_for_i18n tool at
> http://github.com/zigzag/ready_for_i18n
>
> An introduction blog at:
> http://zigzag.github.com/2009/12/17/get-your-local...

Very neat :-)

I've been experimenting with that myself as well. But it only gets me
half the way, since controller code contains texts as well.

Anyway this is an old question and since then I've extracted all texts
by hand. But thanks anyway. :-)

- Carsten
This topic is locked and can not be replied to.