Support .yaml files for i18n
This commit is contained in:
parent
8996e65fd1
commit
7e0ae0e59c
|
@ -26,9 +26,9 @@ module Middleman
|
||||||
|
|
||||||
def initialize(app, options={})
|
def initialize(app, options={})
|
||||||
@app = app
|
@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}}
|
@locales_regex = %r{^#{regex}}
|
||||||
|
|
||||||
@maps = {}
|
@maps = {}
|
||||||
|
@ -81,7 +81,7 @@ module Middleman
|
||||||
def langs
|
def langs
|
||||||
@options[:langs] || begin
|
@options[:langs] || begin
|
||||||
Dir[File.join(@app.root, @locales_glob)].map { |file|
|
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)
|
}.sort.map(&:to_sym)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue