Sha256: 25e2a70208db02627130b70e274c4e84bf8a39456177d988de9e466fd930bd20

Contents?: true

Size: 822 Bytes

Versions: 7

Compression:

Stored size: 822 Bytes

Contents

# encoding: utf-8

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

7 entries across 7 versions & 3 rubygems

Version Path
pepe-i18n-0.2.0 test/gettext/backend_test.rb
thedarkone-i18n-0.2.0 test/gettext/backend_test.rb
polish-0.0.5 lib/vendor/i18n/test/gettext/backend_test.rb
polish-0.0.4 lib/vendor/i18n/test/gettext/backend_test.rb
polish-0.0.3 lib/vendor/i18n/test/gettext/backend_test.rb
polish-0.0.2 lib/vendor/i18n/test/gettext/backend_test.rb
polish-0.0.1 lib/vendor/i18n/test/gettext/backend_test.rb