2016-09-08 8 views
0

私は1つのyml-keyの中に複数のリンクを置いています。rails i18n - 複数のリンクがあるテキストを翻訳する

この投稿rails i18n - translating text with links insideはYAMLキー内部の一つのリンクをカバーし、それが複数のリンクを持つことが可能だ場合、私は思ったんだけど:よう

何か:私の見解では

# en.yml 
additional_terms: additional terms 
data_privacy: data privacy terms 
gtc_link: GTCs 
terms_html: "By accepting the GTCs %{gtc_link}, you confirm that you agree to the %{data_privacy} and %{additional_terms} of the Wirecard payment option." 

を:

<div class="terms"> 
<%= t('view.user.account.terms_html', 
    { 
    gtc_link: link_to(t('pages.imprint.gtc'),"/pdf/agb_#{I18n.locale}.pdf", { target: '_blank' } 
    }, 
    { 
    data_privacy: link_to(t('view.account.data_privacy'),"https://www.wirecardbank.de/privacy-documents/datenschutzhinweis-fur-die-wirecard-zahlarten/", { target: '_blank' } 
    }, 
    { 
    additional_terms: link_to(t('view.account.additional_terms'),"https://www.wirecardbank.de/privacy-documents/datenschutzhinweis-fur-die-wirecard-zahlarten/", { target: '_blank' } 
    }, 
    )) %> 
</div> 
+0

't 'の内部で' {}'を取り除く – AbM

答えて

0

あなたはこれを試しましたか?

<div class="terms"> 
    <%= t('view.user.account.terms_html', 
     gtc_link: link_to(t('pages.imprint.gtc'),"/pdf/agb_# {I18n.locale}.pdf", { target: '_blank' }), 
     data_privacy: link_to(t('view.account.data_privacy'),"https://www.wirecardbank.de/privacy-documents/datenschutzhinweis-fur-die-wirecard-zahlarten/", { target: '_blank' }), 
     additional_terms: link_to(t('view.account.additional_terms'),"https://www.wirecardbank.de/privacy-documents/datenschutzhinweis-fur-die-wirecard-zahlarten/", { target: '_blank' }) 
    ) %> 
</div> 
関連する問題