freeride-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[FR-devel] ruby-locale -- Can we use this in our i18n support?


From: Curt Hibbs
Subject: [FR-devel] ruby-locale -- Can we use this in our i18n support?
Date: Tue, 3 Dec 2002 03:22:22 -0800

Is this something that we can use as part of our eventual i18n support?

Curt

-----Original Message-----
From: Rob Blackbourn [mailto:address@hidden
Sent: Tuesday, December 03, 2002 1:32 AM
To: ruby-talk ML
Subject: [ANN] ruby-locale-0.1


This is the first version of ruby-locale (0.1) which can be found at;
        http://sourceforge.net/projects/ruby-locale/

This is my first Ruby extension (so be on your guard:-). As well as its 
functions it provides an example of how to read and write hash tables in 
Ruby extensions.

ruby-locale is a Ruby ext which provides bindings for setlocale(3) and 
nl_langinfo(3).

require 'locale'
Locale.setlocale(Locale::LC_ALL, 'en_US')
   # "en_GB"
Locale.setlocale(Locale::LC_TIME, 'en_GB')
   # "en_US"
Locale.setlocale(
        Locale::LC_TIME => 'en_GB',
        Locale::LC_MONETARY => 'en_US')
   # {2=>"en_GB", 4=>"en_US"}
Locale::LangInfo.langinfo(Locale::LangInfo::D_T_FMT)
   # "%a %d %b %Y %T %Z"

Locales are not very object oriented.Once set they apply globaly. 
However, having the locale definition in a hash does allow us to pass 
around the definition.

Rob Blackbourn







reply via email to

[Prev in Thread] Current Thread [Next in Thread]