Sha256: af65ffa61b7f582b8b206ec173ef640833bbaad5d6ceb6b540746b487b586934

Contents?: true

Size: 803 Bytes

Versions: 2

Compression:

Stored size: 803 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../test_helper')
require 'i18n/backend/gettext'
require 'i18n/helpers/gettext'

include I18n::Helpers::Gettext

class I18nGettextBackendTest < Test::Unit::TestCase
  def setup
    I18n.locale = :en
    I18n.load_path = [locales_dir + '/de.po']
    I18n.backend.meta_class.send(:include, I18n::Backend::Gettext)
  end
  
  def teardown
    I18n.load_path = nil
    I18n.backend = nil
  end

  def test_backend_loads_po_file
    I18n.backend.send(:init_translations)
    assert I18n.backend.send(:translations)[:de][:"Axis\001Axis"]
  end
  
  def test_looks_up_translation
    I18n.locale = :de
    assert_equal 'Auto', _('car')
  end
  
  def test_pluralizes_entry
    I18n.locale = :de
    assert_equal 'Achsen', ngettext('Axis', 'Axis', 2)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
theoooo-i18n-0.2.1 test/gettext/backend_test.rb
theoooo-i18n-0.2.2 test/gettext/backend_test.rb