ruby - Rails: Outputting translation in link_to() method -


so have link_to method requires body argument populated translated material.

for example: link_to('translated material', '/dashboard')

i have set in en.yml (for example) has:

en:   dashboard: 'dashboard' 

and in typical situation need translation do, example, this: <%= t :dashboard %>

this works great. however, how place link_to() method so:

link_to(*insert :dashboard translated text here*, '/dashboard')

i'm sure it's simple formatting, still learning nuances of ror!

just put together:

link_to(t('dashboard'), dashboard_path) 

btw. preferred use named routes. not use strings urls.


Comments

Popular posts from this blog

mongodb - Struggling to get ordered results from the last retrieved article, given array of elements to search in -

c# - Pausing a storyboard on TabItem mouse over -

c# - Attribute value in root node of xml Linq to XML -