Sha256: c5c56834e7b94e184348050a97b08a71979da2b41e88baac5482ab094e7f44d2

Contents?: true

Size: 809 Bytes

Versions: 10

Compression:

Stored size: 809 Bytes

Contents

# encoding: utf-8
require "spec_helper"

de_file = File.join('spec','locale','de','LC_MESSAGES','test.mo')
de = FastGettext::MoFile.new(de_file)

describe FastGettext::MoFile do
  before :all do
    File.exist?(de_file).should == true
  end

  it "parses a file" do
    de['car'].should == 'Auto'
  end

  it "stores untranslated values as nil" do
    de['Untranslated'].should == nil
  end

  it "finds pluralized values" do
    de.plural('Axis','Axis').should == ['Achse','Achsen']
  end

  it "returns empty array when pluralisation could not be found" do
    de.plural('Axis','Axis','Axis').should == []
  end

  it "can access plurals through []" do
    de['Axis'].should == 'Achse' #singular
  end
  
  it "can successfully translate non-ASCII keys" do
    de["Umläüte"].should == "Umlaute"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
fast_gettext-0.8.1 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.8.0 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.7.1 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.7.0 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.6.12 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.6.11 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.6.10 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.6.9 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.6.8 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.6.7 spec/fast_gettext/mo_file_spec.rb