Sha256: 5317e1a4a5c8f8cb9f3260612030ab9147f33b68a23dd20ef72d3d04e15ffb79

Contents?: true

Size: 893 Bytes

Versions: 9

Compression:

Stored size: 893 Bytes

Contents

require 'spec/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['Car|Model'].should == nil
  end

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

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

  it "returns ids when not plural and singular translations could not be found" do
    de.plural('Axis','Axis','NOTFOUND').should == ['Achse','Achse','NOTFOUND']
  end

  it "can access plurals through []" do
    de['Axis'].should == 'Achse' #singular
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fast_gettext-0.5.10 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.5.9 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.5.8 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.5.7 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.5.6 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.5.5 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.5.4 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.5.3 spec/fast_gettext/mo_file_spec.rb
fast_gettext-0.5.2 spec/fast_gettext/mo_file_spec.rb