Sha256: 65bf4b60c0233d9455bb513fd915e587f91d0607e06a5802a672087d1bfcabe2

Contents?: true

Size: 960 Bytes

Versions: 21

Compression:

Stored size: 960 Bytes

Contents

current_folder = File.dirname(__FILE__)
require File.join(current_folder,'..','spec_helper')

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

describe 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

21 entries across 21 versions & 1 rubygems

Version Path
grosser-fast_gettext-0.3.0 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.3.1 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.3.2 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.3.3 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.3.4 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.3.5 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.3.6 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.3.7 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.3.8 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.4.0 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.4.10 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.4.11 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.4.12 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.4.13 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.4.2 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.4.3 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.4.4 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.4.5 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.4.7 spec/fast_gettext/mo_file_spec.rb
grosser-fast_gettext-0.4.8 spec/fast_gettext/mo_file_spec.rb