14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
# File 'lib/radiant/available_locales.rb', line 14
def self.locales
available_locales = {}
locale_paths.each do |path|
if File.exists? path
Dir.new(path).entries.collect do |x|
result = x =~ /\.yml/ ? x.sub(/\.yml/,"") : nil
result =~ /\_available_tags/ ? nil : result
end.compact.each do |str|
locale_file = YAML.load_file(path + "#{str}.yml")
lang = locale_file[str]["this_file_language"] if locale_file[str]
available_locales.merge! Hash[lang, str] if lang
end.freeze
end
end
available_locales.sort_by{ |s| s[0] }
end
|