Skip to content
joshmh edited this page Sep 13, 2010 · 1 revision

Overview

The Locale class implements the IETF language tags defined in RFC 4646 and RFC 4647.

  • The class will be String-like but will not inherit from String.
  • The class will be case-insensitive, which will influence the various equality, comparison and hash methods.
  • The class will provide to_s.

Here is a quick outline of the class. Attributes may or may not be read-only:


class Locale # is this a String? maybe not.
  attr :language, :script, :region, :variant, :extension, :private_use
  def valid?
    # validate against RFC4646
  end
  def parent
    # return 'en' for 'en-US' etc.
  end
end

Clone this wiki locally