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