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_ALLLocale::LC_COLLATELocale::LC_CTYPELocale::LC_MESSAGESLocale::LC_MONETARYLocale::LC_NUMERICLocale::LC_TIMEEach 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_1Locale::LangInfo::DAY_2Locale::LangInfo::ABDAY_1Locale::LangInfo::ABDAY_2Locale::LangInfo::D_T_FMTThe are many more constants defined. Consult your local documentation for a list of possible items.