[ANN] Ruby-GetText-Package-0.9.0

Hi,

Ruby-GetText-Package-0.9.0 is now available.

Highlights

···

----------
CGI/ERB is now supported.

It is inspired from "Using Gettext To Translate Your
Rails Application"[*1]. The documentation is very
nice for an application, but not complete as a
framework. Because it allows only a textdomain
(messages.mo only).
I'm not good at RoR, so I can't improve it now,
but I hope someone try "real L10n support" on ROR.

[*1] http://manuals.rubyonrails.com/read/book/16

Website
-------
http://ponx.s5.xrea.com/hiki/ruby-gettext.html

* Ruby-GetText-Package HOWTO
  http://ponx.s5.xrea.com/hiki/ruby-gettext-howto.html
* Ruby-GetText-Package HOWTO for CGI/ERB
  http://ponx.s5.xrea.com/hiki/ruby-gettext-howto-cgi.html
* Ruby-GetText-Package API Reference
  http://ponx.s5.xrea.com/hiki/ruby-gettext-api.html

What's this?
-------------
Ruby GetText Package is a Native Language Support Library and
Tools which modeled after GNU gettext package.

Changes since 0.8.1
-------------------
* bugfixes.
* CGI support: gettext/cgi
* ERB support: gettext/erb, rgettext.
* Added samples for CGI/ERB to samples/cgi/.

Translators(samples, rgettext/rmsgfmt):
French - Laurent Sansonetti
German - Detlef Reichl
Italian - Gabriele Renzi
Japanese - Masao Mutoh
Portuguese(Brazil) - Joao Pedrosa
Spanish - David Espada, David Moreno Garza
Swedish - Nikolai Weibull

Translations for other languages are welcome!
# Tell me if you are interested in it.

--
.:% Masao Mutoh<mutoh@highway.ne.jp>

Masao Mutoh wrote:

Hi,

Ruby-GetText-Package-0.9.0 is now available.

Highlights
----------
CGI/ERB is now supported.

It is inspired from "Using Gettext To Translate Your Rails Application"[*1]. The documentation is very nice for an application, but not complete as a framework. Because it allows only a textdomain
(messages.mo only).
I'm not good at RoR, so I can't improve it now,
but I hope someone try "real L10n support" on ROR.

[*1] http://manuals.rubyonrails.com/read/book/16

Ah, thank you Masao, I will integrate this as soon as I can. Much appreciated.

The reason for hacking Ruby-GetText to only use one mo file is that virtually any "web" application I know only has one. This has probably to do something with the amount of files you can have in a web app. For example, a web app can have hundreds of template files. You surely wouldn't want to have hundreds of mo files or use #bindtextdomain all over the place. And if you do you can simply not use the hack :wink:

You are right about the usage as a framework. It would be nice if this behavior would be configurable so one can use whatever fits best.

Sascha Ebach

Hi,

Masao Mutoh wrote:
> Hi,
>
> Ruby-GetText-Package-0.9.0 is now available.
>
> Highlights
> ----------
> CGI/ERB is now supported.
>
> It is inspired from "Using Gettext To Translate Your
> Rails Application"[*1]. The documentation is very
> nice for an application, but not complete as a
> framework. Because it allows only a textdomain
> (messages.mo only).
> I'm not good at RoR, so I can't improve it now,
> but I hope someone try "real L10n support" on ROR.
>
> [*1] http://manuals.rubyonrails.com/read/book/16

Ah, thank you Masao, I will integrate this as soon as I can. Much
appreciated.

I appreciate you too ;). This release is depend on your ideas heavily.

The reason for hacking Ruby-GetText to only use one mo file is that
virtually any "web" application I know only has one. This has probably
to do something with the amount of files you can have in a web app. For
example, a web app can have hundreds of template files. You surely
wouldn't want to have hundreds of mo files or use #bindtextdomain all
over the place. And if you do you can simply not use the hack :wink:

You are right about the usage as a framework. It would be nice if this
behavior would be configurable so one can use whatever fits best.

It's better to describe faults.

* It won't work correctly when it requires other libraries which
   support GetText.
* You can't separate textdomains in a web app such as "bbs", "scheduler".
* If rails uses GetText itself as L10n, it will have "rails" textdomain,
  but it won't work correctly with your hack.

···

On Mon, 2 May 2005 01:44:10 +0900 Sascha Ebach <se@digitale-wertschoepfung.de> wrote:

---
Now, "gettext/container" supports "instance-based/module-based texdomain"
not file-based. It's similer with your idea but it allows plural
textdomains and it also doesn't affect other libraries which support GetText.
#And "gettext/erb" is an instance-based 'ERB' textdomain.

So I think if a class/module which generates HTML from ERB on rails
includes "gettext/erb", then you don't need to call #bindtextdomain on each
files and some faults are solved.

--
.:% Masao Mutoh<mutoh@highway.ne.jp>

* It won't work correctly when it requires other libraries which support GetText.

Correct, but not an issue. At least not in Rails applications. And when it is, just don't use the hack.

* You can't separate textdomains in a web app such as "bbs", "scheduler".

Correct, but I don't think you need more than one domain in 99% of all Rails apps. In case you do, don't use the hack.

* If rails uses GetText itself as L10n, it will have "rails" textdomain,
  but it won't work correctly with your hack.

Hm, I don't understand fully, but again, if it doesn't work with the hack then don't use the hack.

Aren't these all good points to just make it a feature?

Now, "gettext/container" supports "instance-based/module-based texdomain"
not file-based. It's similer with your idea but it allows plural textdomains and it also doesn't affect other libraries which support GetText.
#And "gettext/erb" is an instance-based 'ERB' textdomain.

So I think if a class/module which generates HTML from ERB on rails includes "gettext/erb", then you don't need to call #bindtextdomain on each
files and some faults are solved.

I will have to look into that. Will let you know what I think about it. Might be another week or two though since I am working on some legacy PHP client code at the moment :frowning:

Sascha