0
env.rb =>キュウリのステップ定義にI18n機能を追加するにはどうすればよいですか?
def setup_language_resources
I18n.load_path = ['features/configuration_resources/english.yml']
case ENV['Language']
when 'english'
I18n.locale = :en
when 'spanish'
I18n.locale = :es
when 'italian'
I18n.locale = :it
else
abort("Incorrect language set, cannot continue the test run: supported are 'english', 'italian' or 'spanish'")
end
end
setup_language_resources
ステップ=>私はステップ定義内で私のI18n.t関数を参照することができ、どのように私は "にそれを渡す必要がありますどのように
expect(@browser.text.include?(I18N.t('successful-adoption'))).to be true
世界に "それを利用できるようにするには?
YML =>
---
en:
successful-adoption: "Thank you for adopting a puppy!"
エラーは次のとおりです。
あなたは[the gem](https://github.com/svenfuchs/i18n)を追加しましたか? –
はい、私はそれを解決するように思えました。@ locale = I18nをキュウリのフックの中に追加すると、ステップ定義がロケールにアクセスできるようになり、次に@ locale.t( 'name-here')を呼び出すことができます。 – Jackofspace