diff options
author | José Valim <jose.valim@plataformatec.com.br> | 2012-07-18 00:38:35 -0700 |
---|---|---|
committer | José Valim <jose.valim@plataformatec.com.br> | 2012-07-18 00:38:35 -0700 |
commit | 1b39d39af26ae44e4aecb0b48063f08bc5a9a500 (patch) | |
tree | f0f3ab78c4adabe4c7588c6ee88537268a6d4333 /actionpack/lib | |
parent | 58ccc9f6c5d261f7c1305d822b16447ac3d286b3 (diff) | |
parent | 1b5298e805a7dec4f5b3c465037dec16cbda4156 (diff) | |
download | rails-1b39d39af26ae44e4aecb0b48063f08bc5a9a500.tar.gz rails-1b39d39af26ae44e4aecb0b48063f08bc5a9a500.tar.bz2 rails-1b39d39af26ae44e4aecb0b48063f08bc5a9a500.zip |
Merge pull request #7082 from jalkoby/lazy_lookup_in_abstract_controller
add lazy look up in abstract controller's translate method
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/abstract_controller/translation.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/actionpack/lib/abstract_controller/translation.rb b/actionpack/lib/abstract_controller/translation.rb index 6d68cf4944..b6c484d188 100644 --- a/actionpack/lib/abstract_controller/translation.rb +++ b/actionpack/lib/abstract_controller/translation.rb @@ -1,6 +1,12 @@ module AbstractController module Translation def translate(*args) + key = args.first + if key.is_a?(String) && (key[0] == '.') + key = "#{ controller_path.gsub('/', '.') }.#{ action_name }#{ key }" + args[0] = key + end + I18n.translate(*args) end alias :t :translate @@ -10,4 +16,4 @@ module AbstractController end alias :l :localize end -end
\ No newline at end of file +end |