Module: Locale

Module Locale |
In: | lib/gettext/locale_win32.rb lib/gettext/locale_posix.rb lib/gettext/locale_cgi.rb lib/gettext/locale.rb lib/gettext/locale_table_win32.rb lib/gettext/locale_object.rb lib/gettext/cgi.rb

Locale module manages the locale informations of the application.

Methods

- cgi
- cgi=
- charset
- clear
- codeset
- current
- current=
- current_charset
- default
- default=
- default_locale
- default_locale=
- get
- set
- set_cgi
- set_current
- set_default
- set_default_locale
- setlocale
- system

Classes and Modules
Module Locale::SystemCGI
Module Locale::SystemPosix
Module Locale::SystemWin32
Class Locale::Object
Constants

CTYPE | = | Locale::System::CTYPE #:nodoc:
NUMERIC | = | Locale::System::NUMERIC #:nodoc:
TIME | = | Locale::System::TIME #:nodoc:
COLLATE | = | Locale::System::COLLATE #:nodoc:
MONETARY | = | Locale::System::MONETARY #:nodoc:
MESSAGES | = | Locale::System::MESSAGES #:nodoc:
ALL | = | Locale::System::ALL #:nodoc:
CTYPE | = | 0
| Deprecated.
NUMERIC | = | 1
| Deprecated.
TIME | = | 2
| Deprecated.
COLLATE | = | 3
| Deprecated.
MONETARY | = | 4
| Deprecated.
MESSAGES | = | 5
| Deprecated.
ALL | = | 6
| Deprecated.

Public Instance methods
cgi() [ source ]

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

- Returns: the CGI object

cgi=(cgi_) [ source ]

Sets a CGI object.

- cgi_: CGI object
- Returns: cgi_

charset() [ source ]

Gets the charset of the current locale.

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

clear() [ source ]

Clear default/current locale.

- Returns: self

codeset() [ source ]

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

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

current() [ source ]

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) [ source ]

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() [ source ]

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

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

default() [ source ]

Gets the default locale.

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

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

default=(locale) [ source ]

Same as Locale.set_default.

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

default_locale() [ source ]

Gets the default Locale::Object.

- Returns: the default locale

default_locale=(locale) [ source ]

Sets a default locale. en.UTF-8 is the default value if not set.

- locale: Locale::Object
- Returns: locale

current
get
get(lctype = nil) (Deprecated)
[ source ]

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

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

set(lang)
set(lang, country = nil, charset = nil)
[ source ]

- 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.

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

set_cgi(cgi_) [ source ]

Sets a CGI object.

- cgi_: CGI object
- Returns: self

set_current(lang, country = nil, charset = nil) [ source ]

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) [ source ]

Sets the default locale (Locale::Object).

- locale: the default locale
- Returns: self.

set_default_locale(locale) [ source ]

Sets a default locale. en.UTF-8 is the default value if not set.

- locale: Locale::Object object. You can’t set nil.
- Returns: self

setlocale(lctype, loc) [ source ]

Deprecated. Use Locale.set or Locale.set_current instead.

system() [ source ]

Gets the system locale.

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