Sha256: 1f6af1e28159ed58cf399fade19fa0e8b8719ecf341af91c86c86ec1bd262a73

Contents?: true

Size: 1.14 KB

Versions: 3

Compression:

Stored size: 1.14 KB

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

    # Hungarian is chosen
    context 'when current locale is Hungarian' do
      it 'translation is available' do
        I18n.locale = :'hu'
        expect(translation).to eq 'Irányítószám'
      end
    end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spree_i18n-5.3.0 spec/features/translation_spec.rb
spree_i18n-5.2.0 spec/features/translation_spec.rb
spree_i18n-5.1.0 spec/features/translation_spec.rb