Permalink
Browse files

Allow locales to have numbers, eg es-491

  • Loading branch information...
1 parent ad54ef3 commit dff1752abfd8ef4a223d973fa0e856aff55ce357 @georgepalmer committed Mar 24, 2012
Showing with 2 additions and 2 deletions.
  1. +1 −1 http_accept_language.gemspec
  2. +1 −1 lib/http_accept_language.rb
@@ -1,7 +1,7 @@
# -*- encoding: utf-8 -*-
Gem::Specification.new do |s|
s.name = "http_accept_language"
- s.version = '1.0.2'
+ s.version = '1.0.2.1'
s.authors = ["iain"]
s.email = ["iain@iain.nl"]
s.homepage = "https://github.com/iain/http_accept_language"
@@ -13,7 +13,7 @@ def user_preferred_languages
l += ';q=1.0' unless l =~ /;q=\d+\.\d+$/
l.split(';q=')
end.sort do |x,y|
- raise "Not correctly formatted" unless x.first =~ /^[a-z\-]+$/i
+ raise "Not correctly formatted" unless x.first =~ /^[a-z0-9\-]+$/i
y.last.to_f <=> x.last.to_f
end.collect do |l|
l.first.downcase.gsub(/-[a-z]+$/i) { |x| x.upcase }

0 comments on commit dff1752

Please sign in to comment.