Matchu
6e09b8bc10
Confirmed features: * Output (retrieval, sorting, etc.) * Name (positive and negative, but new behavior) * Flags (positive and negative) Planned features: * users:owns, user:wants Known issues: * Sets are broken * Don't render properly * Shouldn't actually be done as joined sets, anyway, since we actually want (set1_zone1 OR set1_zone2) AND (set2_zone1 OR set2_zone2), which will require breaking it into multiple terms queries. * Name has regressed: ignores phrases, doesn't require *all* words. While we're breaking sets into multiple queries, maybe we'll do something similar for name. In fact, we really kinda have to if we're gonna keep sorting by name, since "straw hat" returns all hats. Eww.
58 lines
1.7 KiB
Ruby
58 lines
1.7 KiB
Ruby
module LocaleMeta
|
|
PUBLIC_LOCALES = []
|
|
USABLE_LOCALES = []
|
|
NEOPETS_LANGUAGE_CODES_BY_LOCALE = {}
|
|
LOCALES_WITH_NEOPETS_LANGUAGE_CODE = []
|
|
COMPATIBLE_LOCALES = {}
|
|
end
|
|
|
|
config = YAML.load_file(Rails.root.join('config', 'locale_meta.yml'))
|
|
|
|
config.each do |locale_str, locale_meta|
|
|
locale = locale_str.to_sym
|
|
|
|
visibility = locale_meta['visibility']
|
|
if visibility == 'public'
|
|
LocaleMeta::PUBLIC_LOCALES << locale
|
|
LocaleMeta::USABLE_LOCALES << locale
|
|
elsif visibility == 'private'
|
|
LocaleMeta::USABLE_LOCALES << locale
|
|
end
|
|
|
|
if locale_meta.has_key?('neopets_language_code')
|
|
neopets_language_code = locale_meta['neopets_language_code']
|
|
LocaleMeta::NEOPETS_LANGUAGE_CODES_BY_LOCALE[locale] = neopets_language_code
|
|
LocaleMeta::LOCALES_WITH_NEOPETS_LANGUAGE_CODE << locale
|
|
elsif locale_meta.has_key?('compatible_with')
|
|
compatible_locale = locale_meta['compatible_with'].to_sym
|
|
LocaleMeta::COMPATIBLE_LOCALES[locale] = compatible_locale
|
|
else
|
|
raise "locale #{locale} must either have a neopets_language_code or " +
|
|
"be compatible_with a locale that does"
|
|
end
|
|
end
|
|
|
|
LocaleMeta::USABLE_LOCALES_WITH_NEOPETS_LANGUAGE_CODE = LocaleMeta::USABLE_LOCALES &
|
|
LocaleMeta::LOCALES_WITH_NEOPETS_LANGUAGE_CODE
|
|
|
|
module I18n
|
|
def self.public_locales
|
|
LocaleMeta::PUBLIC_LOCALES
|
|
end
|
|
|
|
def self.usable_locales
|
|
LocaleMeta::USABLE_LOCALES
|
|
end
|
|
|
|
def self.locales_with_neopets_language_code
|
|
LocaleMeta::LOCALES_WITH_NEOPETS_LANGUAGE_CODE
|
|
end
|
|
|
|
def self.usable_locales_with_neopets_language_code
|
|
LocaleMeta::USABLE_LOCALES_WITH_NEOPETS_LANGUAGE_CODE
|
|
end
|
|
|
|
def self.neopets_language_code_for(locale)
|
|
LocaleMeta::NEOPETS_LANGUAGE_CODES_BY_LOCALE[locale]
|
|
end
|
|
end
|