Skip to content
Browse files

Merge pull request #33 from bquorning/sanitize-latinamerican-spanish

Support numeric language code subtags.
  • Loading branch information...
2 parents e298593 + de70c0a commit a24ebb1aee7bf8e351e05165ecc689bc268c9d83 @DouweM DouweM committed
Showing with 2 additions and 2 deletions.
  1. +1 −1 lib/http_accept_language/parser.rb
  2. +1 −1 spec/parser_spec.rb
View
2 lib/http_accept_language/parser.rb
@@ -74,7 +74,7 @@ def sanitize_available_locales(available_languages)
split_locale = avail.split(/[_-]/)
split_locale.map do |e|
- e unless e.match(/x|[0-9*]/)
+ e unless e.start_with?("x")
end.compact.join("-")
end
end
View
2 spec/parser_spec.rb
@@ -45,7 +45,7 @@ def parser
end
it "should sanitize available language names" do
- parser.sanitize_available_locales(%w{en_UK-x3 en-US-x1 ja_JP-x2 pt-BR-x5}).should eq ["en-UK", "en-US", "ja-JP", "pt-BR"]
+ parser.sanitize_available_locales(%w{en_UK-x3 en-US-x1 ja_JP-x2 pt-BR-x5 es-419-x4}).should eq ["en-UK", "en-US", "ja-JP", "pt-BR", "es-419"]
end
it "should find most compatible language from user preferred" do

0 comments on commit a24ebb1

Please sign in to comment.
Something went wrong with that request. Please try again.