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/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, Translated, Utils Classes: I18n, Locale, TranslatedString, Translation, UnsupportedLocale, Untranslated

Constant Summary collapse

VERSION =
'0.3'

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.untranslatedObject

String, which will be print by untranslated items. You can use special values:

  • %1 – path to untranslated string.

  • %2 – part in path, that exists in translation.

  • %3 – part in path, that isn’t exists in translation.

For example, if you have in translation only:

user:
  login: Login

And write code:

R18n.untranslated = '%2[%3]'

i18n.user.password #=> "user.[password]"


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

def untranslated
  @untranslated
end

Class Method Details

.getObject

Get I18n object for current thread.



44
45
46
# File 'lib/r18n-core.rb', line 44

def get
  Thread.current['i18n']
end

.set(i18n) ⇒ Object

Set I18n object to current thread.



39
40
41
# File 'lib/r18n-core.rb', line 39

def set(i18n)
  Thread.current['i18n'] = i18n
end