String
String, which is translated to some locale and loading from Translation.
Load object from Marshalizing.
# File lib/r18n-core/translated_string.rb, line 68 def self._load(str) arr = str.split(":", 3) new arr[2], R18n.locale(arr[0]), arr[1] end
Returns a new string object containing a copy of str, which translated for path to locale
# File lib/r18n-core/translated_string.rb, line 31 def initialize(str, locale, path, filters = nil) super(str) @filters = filters @locale = locale @path = path end
Override marshal_dump to avoid Marshalizing filter procs
# File lib/r18n-core/translated_string.rb, line 63 def _dump(limit) [@locale.code, @path, to_str].join(":") end
Mark translated string as html safe, because R18n has own escape system.
# File lib/r18n-core/translated_string.rb, line 49 def html_safe? true end
Return untranslated, when user try to go deeper in translation.
# File lib/r18n-core/translated_string.rb, line 81 def method_missing(name, *params) get_untranslated(name.to_s) end
Override to_s to make string html safe if `html_safe` method is defined.
# File lib/r18n-core/translated_string.rb, line 54 def to_s if respond_to? :html_safe html_safe else String.new(self) end end
Generated with the Darkfish Rdoc Generator 2.