Module: I18n
- Defined in:
- lib/motion-i18n/i18n.rb
Class Method Summary collapse
Class Method Details
.locale ⇒ Object
12 13 14 |
# File 'lib/motion-i18n/i18n.rb', line 12 def locale NSLocale.preferredLanguages.first end |
.translate(key, substitutions = {}) ⇒ Object Also known as: t
3 4 5 6 7 8 9 |
# File 'lib/motion-i18n/i18n.rb', line 3 def translate(key, substitutions = {}) String.new((NSBundle.mainBundle.localizedStringForKey(key, value:"", table:nil))).tap do |result| substitutions.each do |key, value| result.sub!("%{#{key}}", value.to_s) end end end |