Sha256: 3f6a11057db0ca6c1562343b9c30414a45f3104bb188fe2b15bfb40781c48ab1

Contents?: true

Size: 909 Bytes

Versions: 1

Compression:

Stored size: 909 Bytes

Contents

# encoding: UTF-8

require File.join(File.dirname(File.dirname(File.dirname(__FILE__))), "spec_helper")
include TwitterCldr

describe LocalizedSymbol do
  describe "#as_language_code" do
    it "returns the correct localized language from the symbol" do
      :es.localize.as_language_code.should == "Spanish"
      FastGettext.locale = :es
      :es.localize.as_language_code.should == "espaƱol"
    end

    it "returns nil if the symbol doesn't correspond to a language code" do
      :blarg.localize.as_language_code.should == nil
    end

    it "returns the correct value for mapped as well as CLDR language codes" do
      :'zh-cn'.localize.as_language_code.should == "Chinese"
      :'zh-tw'.localize.as_language_code.should == "Traditional Chinese"
      :'zh-Hant'.localize.as_language_code.should == "Traditional Chinese"
      :'zh'.localize.as_language_code.should == "Chinese"
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
twitter_cldr-1.0.1 spec/ext/strings/symbol_spec.rb