Sha256: b76b7549febecf9183dd1776aeda22787b33d209d84e16dbeb9904acf497c614

Contents?: true

Size: 923 Bytes

Versions: 11

Compression:

Stored size: 923 Bytes

Contents

# encoding: UTF-8

# Copyright 2012 Twitter, Inc
# http://www.apache.org/licenses/LICENSE-2.0

require '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

11 entries across 11 versions & 1 rubygems

Version Path
twitter_cldr-1.7.0 spec/core_ext/symbol_spec.rb
twitter_cldr-1.6.2 spec/core_ext/symbol_spec.rb
twitter_cldr-1.6.1 spec/core_ext/symbol_spec.rb
twitter_cldr-1.6.0 spec/core_ext/symbol_spec.rb
twitter_cldr-1.5.0 spec/core_ext/symbol_spec.rb
twitter_cldr-1.4.1 spec/core_ext/symbol_spec.rb
twitter_cldr-1.4.0 spec/core_ext/symbol_spec.rb
twitter_cldr-1.3.6 spec/core_ext/symbol_spec.rb
twitter_cldr-1.3.0 spec/core_ext/symbol_spec.rb
twitter_cldr-1.2.0 spec/core_ext/symbol_spec.rb
twitter_cldr-1.1.0 spec/ext/strings/symbol_spec.rb