Can anyone explain how I18n.translate is exposed to the ActionController class and can be used as plain translate or t? I would like to tweak the translate code but can't understand how it is exposed - for example calling translate.source_location throws an error indicating that there is no method translate in class ActionController.
In views and controllers you have access to t helper. Everywhere else you should be using I18n.t.
Here is where ActionController::Base includes AbstractController::Translation with two methods:
translate with alias t
localize with alias l
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With