tha
tha

Reputation: 123

use variable in link_to url name

I got HAML:

%li = link_to raw(t("link.nearby")), country_path(@entry.country_url)

... which is supposed to get link.nearby from a language file:

link:
  nearby: "« View yoga places in %{country}"

... however, this doesn't work and outputs:

« View yoga places in %{country} .

Of course what I want is to make it replace %{country} with its actual value.

edit:

There is a translation of the website, where %{country} is not on the last position of the statement, so just appending it doesn't work here ... I guess it should rather be a modification on the language file-part.

Upvotes: 0

Views: 757

Answers (1)

Ion Br.
Ion Br.

Reputation: 2648

%li = link_to raw(t("link.nearby", :country=>@country_name)), country_path(@entry.country_url)

Upvotes: 1

Related Questions