Fix regex which was allowing i18n to file yaml files in the data folder
This commit is contained in:
parent
37752dc291
commit
c7d3e7d601
7 changed files with 8 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
|||
3.1.x
|
||||
===
|
||||
|
||||
* Locales regex was broken, selecting .yml files from data folder.
|
||||
* Fix for implied extensions getting a layout. (Mentioned in #901)
|
||||
|
||||
3.1.2
|
||||
|
|
|
@ -22,6 +22,8 @@ Feature: i18n Builder
|
|||
| password.txt |
|
||||
Then the following files should not exist:
|
||||
| en/index.html |
|
||||
| defaults_en/index.html |
|
||||
| en_defaults/index.html |
|
||||
And the file "index.html" should contain "Howdy"
|
||||
And the file "hello.html" should contain "Hello World"
|
||||
And the file "morning.html" should contain "Good morning"
|
||||
|
|
|
@ -16,10 +16,14 @@ Feature: i18n Preview
|
|||
Then I should see "Good morning"
|
||||
When I go to "/one.html"
|
||||
Then I should see "Only one"
|
||||
When I go to "/defaults_en/index.html"
|
||||
Then I should see "File Not Found"
|
||||
When I go to "/en/index.html"
|
||||
Then I should see "File Not Found"
|
||||
When I go to "/en/morning.html"
|
||||
Then I should see "File Not Found"
|
||||
When I go to "/defaults_es/index.html"
|
||||
Then I should see "File Not Found"
|
||||
When I go to "/es/index.html"
|
||||
Then I should see "Como Esta?"
|
||||
When I go to "/es/hola.html"
|
||||
|
|
|
@ -93,7 +93,7 @@ class Middleman::CoreExtensions::Internationalization < ::Middleman::Extension
|
|||
|
||||
def convert_glob_to_regex(glob)
|
||||
# File.fnmatch doesn't support brackets: {rb,yml,yaml}
|
||||
regex = @locales_glob.sub(/\./, '\.').sub(File.join("**", "*"), ".*").sub(/\//, '\/').sub("{rb,yml,yaml}", "rb|ya?ml")
|
||||
regex = @locales_glob.sub(/\./, '\.').sub(File.join("**", "*"), ".*").sub(/\//, '\/').sub("{rb,yml,yaml}", "(rb|ya?ml)")
|
||||
%r{^#{regex}}
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue