diff --git a/CHANGELOG.md b/CHANGELOG.md index cebfccdb..baa60508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/middleman-core/features/i18n_builder.feature b/middleman-core/features/i18n_builder.feature index 1e7139be..bf92efce 100644 --- a/middleman-core/features/i18n_builder.feature +++ b/middleman-core/features/i18n_builder.feature @@ -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" diff --git a/middleman-core/features/i18n_preview.feature b/middleman-core/features/i18n_preview.feature index ea1acf11..6f059044 100644 --- a/middleman-core/features/i18n_preview.feature +++ b/middleman-core/features/i18n_preview.feature @@ -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" diff --git a/middleman-core/fixtures/i18n-test-app/data/defaults_en.yml b/middleman-core/fixtures/i18n-test-app/data/defaults_en.yml new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/fixtures/i18n-test-app/data/defaults_es.yml b/middleman-core/fixtures/i18n-test-app/data/defaults_es.yml new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/fixtures/i18n-test-app/data/en_defaults.yml b/middleman-core/fixtures/i18n-test-app/data/en_defaults.yml new file mode 100644 index 00000000..e69de29b diff --git a/middleman-core/lib/middleman-more/core_extensions/i18n.rb b/middleman-core/lib/middleman-more/core_extensions/i18n.rb index a1d19f1f..2f8cbdfa 100644 --- a/middleman-core/lib/middleman-more/core_extensions/i18n.rb +++ b/middleman-core/lib/middleman-more/core_extensions/i18n.rb @@ -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