Sha256: 6df1be43a87a88b2fa95cdc7c7f2bc279ecbe7887cd4e4b89ab8325a9e6e431c

Contents?: true

Size: 864 Bytes

Versions: 4

Compression:

Stored size: 864 Bytes

Contents

require File.expand_path('spec/spec_helper')
require 'fast_gettext/po_file'

de_file = File.join('spec','locale','de','test.po')
de = FastGettext::PoFile.to_mo_file(de_file)

describe FastGettext::PoFile 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 == "Modell"
  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 "unescapes '\\'" do
    de["You should escape '\\' as '\\\\'."].should == "Du solltest '\\' als '\\\\' escapen."
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
fast_gettext-0.6.6 spec/fast_gettext/po_file_spec.rb
fast_gettext-0.6.5 spec/fast_gettext/po_file_spec.rb
fast_gettext-0.6.4 spec/fast_gettext/po_file_spec.rb
fast_gettext-0.6.3 spec/fast_gettext/po_file_spec.rb