Merge pull request #756 from bhollis/yaml

l18n: Should load both locales/*.yml and locales/*.yaml files
This commit is contained in:
Thomas Reynolds 2013-02-09 14:40:10 -08:00
commit 7f7ce07910

View file

@ -26,9 +26,9 @@ module Middleman
def initialize(app, options={})
@app = app
@locales_glob = File.join(app.locales_dir, "**", "*.{rb,yml}")
@locales_glob = File.join(app.locales_dir, "**", "*.{rb,yml,yaml}")
regex = @locales_glob.sub(/\./, '\.').sub(File.join("**", "*"), ".*").sub(/\//, '\/').sub("{rb,yml}", "rb|yml")
regex = @locales_glob.sub(/\./, '\.').sub(File.join("**", "*"), ".*").sub(/\//, '\/').sub("{rb,yml,yaml}", "rb|ya?ml")
@locales_regex = %r{^#{regex}}
@maps = {}
@ -81,7 +81,7 @@ module Middleman
def langs
@options[:langs] || begin
Dir[File.join(@app.root, @locales_glob)].map { |file|
File.basename(file).sub(/\.yml$/, "").sub(/\.rb$/, "")
File.basename(file).sub(/\.ya?ml$/, "").sub(/\.rb$/, "")
}.sort.map(&:to_sym)
end
end