[gettext-u-en] Switching locale in command-line app?
mutoh at highway.ne.jp
Fri Feb 24 09:35:25 EST 2006
How about to use Locale::CTYPE instead of Locale::MESSAGES ?
On Thu, 23 Feb 2006 17:44:45 +0000
David Holroyd <dave at badgers-in-foil.co.uk> wrote:
> I'm using libgettext-ruby 0.8.0-1 (from Debian).
> I wrote the following codes to swap locales while my application is
> generating some output in a language selected by the user,
> def with_message_locale(locale)
> if locale
> old_locale = Locale.get
> Locale.set(Locale::MESSAGES, locale)
> Locale.set(Locale::MESSAGES, old_locale)
> I then do something like,
> with_message_locale("i_piglatin") do
> ... some uses of _("blah") ...
> It doesn't appear to make any difference. Is Locale.set() the correct
> API for this purpose?
> (Switching locale for the whole app using LC_MESSAGES=i_piglatin works
> fine, BTW.)
> gettext-users-en mailing list
> gettext-users-en at rubyforge.org
.:% Masao Mutoh<mutoh at highway.ne.jp>
More information about the gettext-users-en