0
私は国際化レールガイドでは、彼らは次のコードを持っていることに気づい:%{...}
はYamlのパーセント記号の意味は何ですか?
en:
activerecord:
errors:
template:
header:
one: "1 error prohibited this %{model} from being saved"
other: "%{count} errors prohibited this %{model} from being saved"
body: "There were problems with the following fields:"
何を意味するのですか?これは#{...}
とどう違うのですか?
ありがとうございました!私はそれをもっと読むべきだったと思う。 – Max
もっと重要なことは...これは単なる文字列補間です。 '%{h} '%{h:' bar '}'は 'foo_bar''を返す – Dudo
@Mallanagaしかし、質問は'%{...} 'と'#{...} 'に関するものです。後者はRubyの文字列補間で、前者は 'sprintf'の' String#% 'エイリアスを介して実行時の"補間 "("置換 "IMOと呼ばれる方がよいでしょう)です。 –