Sha256: 30b393c8db3e33a9f8477d580b0f3b758463451d149bc9b3ebcafb4ba9bc8aa7

Contents?: true

Size: 952 Bytes

Versions: 2

Compression:

Stored size: 952 Bytes

Contents

# encoding: utf-8

RSpec.describe 'Translation' do
  def translation
    I18n.t('activerecord.attributes.spree/address.zipcode')
  end

  context 'when current locale is en' do
    it 'translation is available' do
      I18n.locale = :en
      expect(translation).to eq 'Zip Code'
    end
  end

  # German is chosen as an example of language whose translations are found in a file.
  context 'when current locale is German' do
    it 'translation is available' do
      I18n.locale = :de
      expect(translation).to eq 'PLZ'
    end
  end

  # Chilean spanish is chosen
  context 'when current locale is Chilean Spanish' do
    it 'translation is available' do
      I18n.locale = :'es-CL'
      expect(translation).to eq 'Código Postal'
    end
  end

    # Swedish is chosen
  context 'when current locale is Swedish' do
    it 'translation is available' do
      I18n.locale = :'sv'
      expect(translation).to eq 'Postnummer'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
spree_i18n-5.0.1 spec/features/translation_spec.rb
spree_i18n-5.0.0 spec/features/translation_spec.rb