Fix #823-2 to allow only one extension on localized views

Make Sitemap::Store#strip_away_locale actually do something
This commit is contained in:
Jonathan Allard 2013-05-30 13:20:57 -04:00
parent 31f238f881
commit 56f16c2488
6 changed files with 14 additions and 3 deletions

View file

@ -13,9 +13,11 @@ Feature: i18n Builder
| index.html | | index.html |
| hello.html | | hello.html |
| morning.html | | morning.html |
| one.html |
| es/index.html | | es/index.html |
| es/hola.html | | es/hola.html |
| es/manana.html | | es/manana.html |
| es/una.html |
| CNAME | | CNAME |
| password.txt | | password.txt |
Then the following files should not exist: Then the following files should not exist:
@ -23,9 +25,11 @@ Feature: i18n Builder
And the file "index.html" should contain "Howdy" And the file "index.html" should contain "Howdy"
And the file "hello.html" should contain "Hello World" And the file "hello.html" should contain "Hello World"
And the file "morning.html" should contain "Good morning" And the file "morning.html" should contain "Good morning"
And the file "one.html" should contain "Only one"
And the file "es/index.html" should contain "Como Esta?" And the file "es/index.html" should contain "Como Esta?"
And the file "es/hola.html" should contain "Hola World" And the file "es/hola.html" should contain "Hola World"
And the file "es/manana.html" should contain "Buenos días" And the file "es/manana.html" should contain "Buenos días"
And the file "es/una.html" should contain "Solamente una"
And the file "CNAME" should contain "test.github.com" And the file "CNAME" should contain "test.github.com"
And the file "password.txt" should contain "hunter2" And the file "password.txt" should contain "hunter2"
@ -145,4 +149,4 @@ Feature: i18n Builder
And the file "index.html" should contain '"stylesheets/site.css"' And the file "index.html" should contain '"stylesheets/site.css"'
And the file "hello.html" should contain '"stylesheets/site.css"' And the file "hello.html" should contain '"stylesheets/site.css"'
And the file "es/index.html" should contain '"../stylesheets/site.css"' And the file "es/index.html" should contain '"../stylesheets/site.css"'
And the file "es/hola.html" should contain '"../stylesheets/site.css"' And the file "es/hola.html" should contain '"../stylesheets/site.css"'

View file

@ -14,6 +14,8 @@ Feature: i18n Preview
Then I should see "Hello World" Then I should see "Hello World"
When I go to "/morning.html" When I go to "/morning.html"
Then I should see "Good morning" Then I should see "Good morning"
When I go to "/one.html"
Then I should see "Only one"
When I go to "/en/index.html" When I go to "/en/index.html"
Then I should see "File Not Found" Then I should see "File Not Found"
When I go to "/en/morning.html" When I go to "/en/morning.html"
@ -24,6 +26,8 @@ Feature: i18n Preview
Then I should see "Hola World" Then I should see "Hola World"
When I go to "/es/manana.html" When I go to "/es/manana.html"
Then I should see "Buenos días" Then I should see "Buenos días"
When I go to "/es/una.html"
Then I should see "Solamente una"
Scenario: A template changes i18n during preview Scenario: A template changes i18n during preview
Given a fixture app "i18n-test-app" Given a fixture app "i18n-test-app"
@ -241,4 +245,4 @@ Feature: i18n Preview
Then I should see "More" Then I should see "More"
When I go to "/es/" When I go to "/es/"
Then I should see "Como Esta?" Then I should see "Como Esta?"
Then I should see "Mucho" Then I should see "Mucho"

View file

@ -3,6 +3,7 @@ es:
paths: paths:
hello: "hola" hello: "hola"
morning: "manana" morning: "manana"
one: "una"
greetings: "Como Esta?" greetings: "Como Esta?"
hi: "Hola" hi: "Hola"

View file

@ -0,0 +1 @@
Only one

View file

@ -0,0 +1 @@
Solamente una

View file

@ -250,7 +250,7 @@ module Middleman
path_bits = path.split('.') path_bits = path.split('.')
lang = path_bits.last lang = path_bits.last
if app.langs.include?(lang.to_sym) if app.langs.include?(lang.to_sym)
return path_bits[0..-1].join('.') return path_bits[0..-2].join('.')
end end
end end