Module | Locale
In: | lib/locale/base.rb lib/locale/object.rb lib/locale/jruby.rb lib/locale/posix.rb lib/locale/win32_table.rb lib/locale/win32.rb lib/locale/cgi.rb lib/locale.rb

Locale module manages the locale informations of the application.

### Methods

cgi cgi= charset clear codeset current current= current_charset default default= get set set_cgi set_current set_default system system_module

### Classes and Modules

Module Locale::SystemBase
Module Locale::SystemCGI
Module Locale::SystemJRuby
Module Locale::SystemPosix
Module Locale::SystemWin32
Module Locale::SystemWin32Table
Class Locale::Object

### Public Instance methods

cgi()

Gets the CGI object. If it is nil, returns new CGI object.

- Returns: the CGI object

cgi=(cgi_)

Sets a CGI object.

- cgi_: CGI object
- Returns: cgi_

charset()

Gets the charset of the current locale.

- Returns: the charset of the current locale (String)

clear()

Clear default/current locale.

- Returns: self

codeset()

Same as charset. Gets the charset of the current locale.

- Returns: the charset of the current locale (String)

current()

Gets the current locale (Locale::Object).

If the current locale is not set, this returns default locale.

- Returns: the current locale (Locale::Object).

current=(lang)

Sets a current locale. This is a single argument version of Locale.set_current.

- lang: the Locale::Object
- Returns: the current locale (Locale::Object).

       Locale.current = "ja_JP.eucJP"
       Locale.current = Locale::Object.new("ja", "JP", "eucJP")

current_charset()

Same as codeset. Returns the charset of the current locale.

- Returns: the charset of the current locale (String)

default()

Gets the default locale.

If the default locale not set, this returns system locale.

- Returns: the default locale (Locale::Object).

default=(locale)

Same as Locale.set_default.

- locale: the default locale (Locale::Object).
- Returns: locale.

current
get

- Returns: the current locale (Locale::Object).

Notice: lctype is deprecated. Use this with no parameter instead.

set(lang)
set(lang, country = nil, charset = nil)

- lang: language as String, or Locale::Object
- country: country as String or nil
- charset: charset as String or nil
- Returns: a Locale::Object.

Sets a default locale. This function is an alias of Locale.set_default with calling set_current(nil).

Notice: Locale.set(lctype, locale) is deprecated.

set_cgi(cgi_)

Sets a CGI object.

- cgi_: CGI object
- Returns: self

set_current(lang, country = nil, charset = nil)

Sets a locale as the current locale.

This returns the current Locale::Object.

- lang: Locale::Object or locale name(String), or language name.
- country: the country code(String)
- charset: the charset(override the charset even if the locale name has charset).
- Returns: self

       Locale.set_current("ja_JP.eucJP")
       Locale.set_current("ja", "JP")
       Locale.set_current("ja", "JP", "eucJP")
       Locale.set_current("ja", nil, "eucJP")
       Locale.set_current(Locale::Object.new("ja", "JP", "eucJP"))

set_default(locale)

Sets the default locale (Locale::Object or String(such as ja_JP.eucJP)).

- locale: the default locale
- Returns: self.

system()

Gets the system locale.

- Returns: the system locale (Locale::Object).

system_module()

Gets the current system module. This is used for debugging.

- Returns: the system module.

[Validate]