Class: O18n
- Inherits:
-
Object
- Object
- O18n
- Defined in:
- lib/o18n.rb
Overview
extension of I18n
Constant Summary collapse
- ENV_REGEX =
/\$ENV\{(\w*)\}/.freeze
Class Method Summary collapse
Class Method Details
.t(*args, **kwargs) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/o18n.rb', line 7 def self.t(*args, **kwargs) value = I18n.t(*args, **kwargs) value.gsub(ENV_REGEX) do envar = ENV[Regexp.last_match(1)] if envar.blank? Regexp.last_match(1).titleize else I18n.exists?(envar) ? I18n.t(envar) : envar end end end |