Sha256: 51b11fd9124cd0bd0a1d4b5175792bd9172aad7239604a2d3e68aba7405927dc

Contents?: true

Size: 778 Bytes

Versions: 2

Compression:

Stored size: 778 Bytes

Contents

=begin

 tag.rb - Locale::Tag module

 Copyright (C) 2008  Masao Mutoh
 
 $Id: tag.rb 27 2008-12-03 15:06:50Z mutoh $
=end

require 'locale/tag/simple'
require 'locale/tag/illegular'
require 'locale/tag/common'
require 'locale/tag/rfc'
require 'locale/tag/cldr'
require 'locale/tag/posix'

module Locale

  # Language tag / locale identifiers.
  module Tag
    module_function
    # Parse a language tag/locale name and return Locale::Tag
    # object.
    # * tag: a tag as a String. e.g.) ja-Hira-JP
    # * Returns: a Locale::Tag subclass.
    def parse(tag)
      # Common is not used here.
      [Simple, Common, Rfc, Cldr, Posix].each do |parser|
        ret = parser.parse(tag)
        return ret if ret
      end
      Locale::Tag::Illegular.new(tag)
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
locale-0.9.0 lib/locale/tag.rb
locale-2.0.0 lib/locale/tag.rb