I use i18n for View
at Rails4.
My Rails YAML file and HTML(ERB) file
YAML
this is the YAML file(for Japanese).
---
ja:
MODEL_NAMEs:
edit:
title: 編集:%{model}
HTML
this is html file written by erb.
<h2><%= t('.title') %></h2>
Result of View
Question
How to replace the placeholder(in this case %{model}
), automatically model name?
P.S
@Amit Sharma advice.
ja:
MODEL_NAMEs:
edit:
title: "編集:%{model}"
and
<h2><%= t('MODEL_NAMEs.edit.title', model: "test") %></h2>
and rails
restart. then 編集:test
was shown.
so. model is may be nil
or something.
I want to
<h2><%= t('.title') %></h2> #=> 編集:MODEL_NAME
Do not rails auto insert model?
I think auto insert %{model}
. because submit
work so.
<%= t('MODEL_NAMEs.edit.title', model: "test") %>
` – Amit Sharma Sep 15 '15 at 07:17