This is a common problem, how to break complex nested fragments of text.
Using markdowns to simplify it
This is the initial commit in this repository [browse the initial tree state](http://example.com/some/path) .
Perhaps in Chinese you say instead
这是第一个提交在这个知识库[看初始状态](http://example.com/some/path) 。
We should consider 3 things:
- External text
- Link text
- Order and position of these two
If the position of the link relative to the text does not need to be changed, then @WattsInABox is correct.
views.commits.message: "This is the initial commit in this repository" views.commits.browse: "browse the initial tree state"
Then we just make
<p> <%= t "views.commits.message" %> <%= link_to t("views.commits.browse"), tree_path(@commit.id) %> . </p>
But sometimes order and position matter, in which case we can try to be more intelligent.
views.commits.message: "This is the initial commit in this repository %{link}" views.commits.browse: "browse the initial tree state"
Then we can interpolate the link in the right place
<p> <%= t "views.commits.message", link: link_to(t("views.commits.browse"), tree_path(@commit.id)) %> </p>
source share