Module: R18n

Defined in:
lib/r18n-core/utils.rb,
lib/r18n-core.rb,
lib/r18n-core/i18n.rb,
lib/r18n-core/locale.rb,
lib/r18n-core/filters.rb,
lib/r18n-core/version.rb,
lib/r18n-core/translated.rb,
lib/r18n-core/translation.rb,
lib/r18n-core/yaml_loader.rb,
lib/r18n-core/untranslated.rb,
lib/r18n-core/translated_string.rb,
lib/r18n-core/unsupported_locale.rb

Overview

Locale withou information file to i18n support.

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: Filters, Loader, Locales, Translated, Utils Classes: I18n, Locale, TranslatedString, Translation, Typed, UnsupportedLocale, Untranslated

Constant Summary collapse

VERSION =
'0.4.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.cacheObject

Hash of hash-like (see Moneta) object to store loaded translations.



63
64
65
# File 'lib/r18n-core.rb', line 63

def cache
  @cache
end

.default_loaderObject

Default loader class, which will be used if you didn’t send loader to I18n.new (object with available and load methods).



56
57
58
# File 'lib/r18n-core.rb', line 56

def default_loader
  @default_loader
end

.extension_placesObject

Loaders with extension translations. If application translations with same locale isn’t exists, extension file willn’t be used.



60
61
62
# File 'lib/r18n-core.rb', line 60

def extension_places
  @extension_places
end

Class Method Details

.getObject

Get I18n object for current thread.



50
51
52
# File 'lib/r18n-core.rb', line 50

def get
  @i18n ||= (@setter.call if @setter)
end

.set(i18n = nil, &block) ⇒ Object

Set I18n object to current thread.



40
41
42
43
44
45
46
47
# File 'lib/r18n-core.rb', line 40

def set(i18n = nil, &block)
  if block_given?
    @setter = block
    @i18n = nil
  else
    @i18n = i18n
  end
end