def initialize(name, topdir = nil)
@name = name
if topdir
path_rules = ["#{topdir}/%{lang}/LC_MESSAGES/%{name}.mo", "#{topdir}/%{lang}/%{name}.mo"]
else
path_rules = self.class.default_path_rules
end
@locale_paths = {}
path_rules.each do |rule|
this_path_rules = rule % {:lang => "([^\/]+)", :name => name}
Dir.glob(rule %{:lang => "*", :name => name}).each do |path|
if /#{this_path_rules}/ =~ path
@locale_paths[$1] = path unless @locale_paths[$1]
end
end
end
@supported_locales = @locale_paths.keys.sort
end