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

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -