a module to provide locale features.
Use with module methods and constants to set the locales for given categories.
require 'locale'
To set the locale for all categories use the LC_ALL category.
Locale.setlocal(Locale::LC_ALL, 'en_GB')
To set the locale for a specific category use the specific category name.
Locale.setlocal(Locale::LC_TIME, 'ja_JP')
To set a number of categories use a hash.
Locale.setlocal(Locale::LC_MONETARY => 'en_GB', Locale::LC_TIME => 'ja_JP')
Locale#setlocale(category, locale)
Locale#setlocale(category_locale_hash)
Locale::LC_ALL
Locale::LC_COLLATE
Locale::LC_CTYPE
Locale::LC_MESSAGES
Locale::LC_MONETARY
Locale::LC_NUMERIC
Locale::LC_TIME
Each constant provides an integer value for each category (except LC_ALL which represents all categories). The constants defined are the most common; ther may be more categories available. Consult the local documentation for any other categories.
For a good discussion of the use of locales see "The GNU C Library", chapter "Locales and Internationalization".
a module to query language and locale information.
Locale::LangInfo.langinfo(Locale::LangInfo::D_T_FMT)
to return the format string for the date time in the currently set locale.
Locale::LangInfo#langinfo(item)
Locale::LangInfo::DAY_1
Locale::LangInfo::DAY_2
Locale::LangInfo::ABDAY_1
Locale::LangInfo::ABDAY_2
Locale::LangInfo::D_T_FMT
The are many more constants defined. Consult your local documentation for a list of possible items.