Class: R18n::TranslatedString

Inherits:
String
  • Object
show all
Defined in:
lib/r18n-core/translated_string.rb

Overview

String, which is translated to some locale and loading from Translation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(str, locale, path) ⇒ TranslatedString

Returns a new string object containing a copy of str, which translated for path to locale



32
33
34
35
36
# File 'lib/r18n-core/translated_string.rb', line 32

def initialize(str, locale, path)
  super(str)
  @locale = locale
  @path = path
end

Instance Attribute Details

#localeObject (readonly)

String locale



25
26
27
# File 'lib/r18n-core/translated_string.rb', line 25

def locale
  @locale
end

#pathObject (readonly)

Path for this translation.



28
29
30
# File 'lib/r18n-core/translated_string.rb', line 28

def path
  @path
end

Instance Method Details

#translated?Boolean

Return true for translated strings.

Returns:

  • (Boolean)


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

def translated?
  true
end

#|(default) ⇒ Object

Return self for translated string.



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

def |(default)
  self
end