[gettext-u-en] Switching locale in command-line app?
Masao Mutoh
mutoh at highway.ne.jp
Fri Feb 24 09:35:25 EST 2006
Hi,
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:
> Hi,
>
> 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)
> begin
> yield
> ensure
> Locale.set(Locale::MESSAGES, old_locale)
> end
> else
> yield
> end
> end
>
> I then do something like,
>
> with_message_locale("i_piglatin") do
> ... some uses of _("blah") ...
> end
>
> 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.)
>
>
> thanks!
> dave
>
> --
> http://david.holroyd.me.uk/
> _______________________________________________
> gettext-users-en mailing list
> gettext-users-en at rubyforge.org
> http://rubyforge.org/mailman/listinfo/gettext-users-en
>
--
--
.:% Masao Mutoh<mutoh at highway.ne.jp>
More information about the gettext-users-en
mailing list