Update to latest upstream i18n-js

The issues we had before seem to be fixed now, so drop our
custom version and go back to the upstream one with some minor
monkey patching tweaks.

This also fixes the sprockets dependencies to correctly rebuild
the javascript when the translations change.
This commit is contained in:
Tom Hughes 2015-06-16 19:17:37 +01:00
parent cf8a20962b
commit 445e608bae
3 changed files with 11 additions and 25 deletions

View file

@ -50,7 +50,7 @@ gem "composite_primary_keys", "~> 8.1.0"
gem "http_accept_language", "~> 2.0.0" gem "http_accept_language", "~> 2.0.0"
gem "paperclip", "~> 4.0" gem "paperclip", "~> 4.0"
gem "deadlock_retry", ">= 1.2.0" gem "deadlock_retry", ">= 1.2.0"
gem "openstreetmap-i18n-js", ">= 3.0.0.rc5.3", :require => "i18n-js" gem "i18n-js", ">= 3.0.0.rc10"
gem "rack-cors" gem "rack-cors"
gem "actionpack-page_caching" gem "actionpack-page_caching"

View file

@ -96,6 +96,8 @@ GEM
http_accept_language (2.0.5) http_accept_language (2.0.5)
httpclient (2.6.0.1) httpclient (2.6.0.1)
i18n (0.7.0) i18n (0.7.0)
i18n-js (3.0.0.rc10)
i18n (~> 0.6)
jquery-rails (4.0.3) jquery-rails (4.0.3)
rails-dom-testing (~> 1.0) rails-dom-testing (~> 1.0)
railties (>= 4.2.0) railties (>= 4.2.0)
@ -128,7 +130,7 @@ GEM
mime-types (2.6.1) mime-types (2.6.1)
mini_portile (0.6.2) mini_portile (0.6.2)
minitest (5.7.0) minitest (5.7.0)
multi_json (1.11.0) multi_json (1.11.1)
multi_xml (0.5.5) multi_xml (0.5.5)
multipart-post (2.0.0) multipart-post (2.0.0)
netrc (0.10.3) netrc (0.10.3)
@ -162,8 +164,6 @@ GEM
omniauth-windowslive (0.0.9) omniauth-windowslive (0.0.9)
multi_json (>= 1.0.3) multi_json (>= 1.0.3)
omniauth-oauth2 (~> 1.0) omniauth-oauth2 (~> 1.0)
openstreetmap-i18n-js (3.0.0.rc5.3)
i18n
openstreetmap-omniauth-google-oauth2 (0.2.6.1) openstreetmap-omniauth-google-oauth2 (0.2.6.1)
jwt (~> 1.0) jwt (~> 1.0)
multi_json (~> 1.3) multi_json (~> 1.3)
@ -221,7 +221,7 @@ GEM
thor (>= 0.18.1, < 2.0) thor (>= 0.18.1, < 2.0)
rainbow (2.0.0) rainbow (2.0.0)
rake (10.4.2) rake (10.4.2)
redcarpet (3.3.0) redcarpet (3.3.1)
ref (1.0.5) ref (1.0.5)
rest-client (1.8.0) rest-client (1.8.0)
http-cookie (>= 1.0.2, < 2.0) http-cookie (>= 1.0.2, < 2.0)
@ -307,6 +307,7 @@ DEPENDENCIES
htmlentities htmlentities
http_accept_language (~> 2.0.0) http_accept_language (~> 2.0.0)
httpclient httpclient
i18n-js (>= 3.0.0.rc10)
jquery-rails jquery-rails
jshint jshint
json json
@ -320,7 +321,6 @@ DEPENDENCIES
omniauth-facebook omniauth-facebook
omniauth-openid omniauth-openid
omniauth-windowslive omniauth-windowslive
openstreetmap-i18n-js (>= 3.0.0.rc5.3)
openstreetmap-omniauth-google-oauth2 (>= 0.2.6.1) openstreetmap-omniauth-google-oauth2 (>= 0.2.6.1)
paperclip (~> 4.0) paperclip (~> 4.0)
pg pg

View file

@ -11,28 +11,14 @@ module I18n
end end
module JS module JS
class << self class FallbackLocales
def make_ordered(unordered) def default_fallbacks_with_validation
ordered = ActiveSupport::OrderedHash.new default_fallbacks_without_validation.select do |locale|
::I18n.available_locales.include?(locale)
unordered.keys.sort { |a, b| a.to_s <=> b.to_s }.each do |key|
value = unordered[key]
if value.is_a?(Hash)
ordered[key] = make_ordered(value)
else
ordered[key] = value
end
end end
ordered
end end
def filtered_translations_with_order alias_method_chain :default_fallbacks, :validation
make_ordered(filtered_translations_without_order)
end
alias_method_chain :filtered_translations, :order
end end
end end
end end