1 class Locale < I18n::Locale::Tag::Rfc4646
6 super(tags.map { |tag| Locale.tag(tag) }).compact!
9 def candidates(preferred)
10 preferred.expand & self
13 def preferred(preferred)
14 candidates(preferred).first
18 List.new(reverse.each_with_object([]) do |locale, expanded|
19 locale.candidates.uniq.reverse_each do |candidate|
20 expanded << candidate if candidate == locale || !expanded.include?(candidate)
22 end.reverse.uniq << Locale.default)
27 List.new(tags.flatten)
31 tag(I18n.default_locale)
35 @available ||= List.new(I18n.available_locales).reject!(&:invalid?)
39 I18n.t("activerecord.models.acl", :locale => self, :fallback => false, :raise => true).nil?
40 rescue I18n::MissingTranslationData
45 List.new([self.class.new(language, script, region, variant),
46 self.class.new(language, script, region),
47 self.class.new(language, script, nil, variant),
48 self.class.new(language, script),
49 self.class.new(language, nil, region, variant),
50 self.class.new(language, nil, region),
51 self.class.new(language, nil, nil, variant),
52 self.class.new(language)])