“t” method in models and controllers

I’m using the i18n api in my pet project and ran into a little problem: I need to use the “t” method in models and controllers, but I couldn’t since “t” is for views.

I thought about including the views modules where needed, which is very ugly. But, Ryan Bates showed me the solution: If you’re outside the view, call “I18n.translate”.


This entry was posted in en-US and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <pre> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>