Module: R18n

Defined in:
lib/r18n-desktop.rb,
lib/r18n-desktop/osx.rb,
lib/r18n-desktop/java.rb,
lib/r18n-desktop/posix.rb,
lib/r18n-desktop/win32.rb,
lib/r18n-desktop/version.rb

Overview

Copyright © 2008 Andrey “A.I.” Sitnik <[email protected]>

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along with this program. If not, see <www.gnu.org/licenses/>.

Defined Under Namespace

Modules: Desktop Classes: I18n

Class Method Summary collapse

Class Method Details

.from_env(translations_places = nil, manual = nil) ⇒ Object

Get user locale from system environment and load I18n object with locale information and translations from ‘translations_places`. If user set locale `manual` put it as last argument.



39
40
41
42
43
44
45
# File 'lib/r18n-desktop.rb', line 39

def from_env(translations_places = nil, manual = nil)
  ::R18n.default_places { translations_places }
  locales = Array(R18n::I18n.system_locale)
  locales.unshift(ENV['LANG']) if ENV['LANG']
  locales.unshift(manual)      if manual
  set ::R18n::I18n.new(locales, translations_places)
end