Created
January 7, 2009 12:02
-
-
Save tomlea/44259 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# t(:foo) now looks for admin.blog_controller.foo, then if not found it then goes for admin.foo, then finally just foo. | |
def ApplicationController.has_controler_specific_translation_helper_fu | |
def t(key, options = {}) | |
controller_name = self.controller_name + "_controller" | |
defaults = [[:admin, controller_name, key], [:admin, key], [key]].map{|a| a.join(".").to_sym} | |
key, defaults = *defaults | |
options[:default] = defaults | |
I18n.t(key, options) | |
end | |
helper_method :t | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment