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:
parent
cf8a20962b
commit
445e608bae
3 changed files with 11 additions and 25 deletions
2
Gemfile
2
Gemfile
|
@ -50,7 +50,7 @@ gem "composite_primary_keys", "~> 8.1.0"
|
|||
gem "http_accept_language", "~> 2.0.0"
|
||||
gem "paperclip", "~> 4.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 "actionpack-page_caching"
|
||||
|
||||
|
|
10
Gemfile.lock
10
Gemfile.lock
|
@ -96,6 +96,8 @@ GEM
|
|||
http_accept_language (2.0.5)
|
||||
httpclient (2.6.0.1)
|
||||
i18n (0.7.0)
|
||||
i18n-js (3.0.0.rc10)
|
||||
i18n (~> 0.6)
|
||||
jquery-rails (4.0.3)
|
||||
rails-dom-testing (~> 1.0)
|
||||
railties (>= 4.2.0)
|
||||
|
@ -128,7 +130,7 @@ GEM
|
|||
mime-types (2.6.1)
|
||||
mini_portile (0.6.2)
|
||||
minitest (5.7.0)
|
||||
multi_json (1.11.0)
|
||||
multi_json (1.11.1)
|
||||
multi_xml (0.5.5)
|
||||
multipart-post (2.0.0)
|
||||
netrc (0.10.3)
|
||||
|
@ -162,8 +164,6 @@ GEM
|
|||
omniauth-windowslive (0.0.9)
|
||||
multi_json (>= 1.0.3)
|
||||
omniauth-oauth2 (~> 1.0)
|
||||
openstreetmap-i18n-js (3.0.0.rc5.3)
|
||||
i18n
|
||||
openstreetmap-omniauth-google-oauth2 (0.2.6.1)
|
||||
jwt (~> 1.0)
|
||||
multi_json (~> 1.3)
|
||||
|
@ -221,7 +221,7 @@ GEM
|
|||
thor (>= 0.18.1, < 2.0)
|
||||
rainbow (2.0.0)
|
||||
rake (10.4.2)
|
||||
redcarpet (3.3.0)
|
||||
redcarpet (3.3.1)
|
||||
ref (1.0.5)
|
||||
rest-client (1.8.0)
|
||||
http-cookie (>= 1.0.2, < 2.0)
|
||||
|
@ -307,6 +307,7 @@ DEPENDENCIES
|
|||
htmlentities
|
||||
http_accept_language (~> 2.0.0)
|
||||
httpclient
|
||||
i18n-js (>= 3.0.0.rc10)
|
||||
jquery-rails
|
||||
jshint
|
||||
json
|
||||
|
@ -320,7 +321,6 @@ DEPENDENCIES
|
|||
omniauth-facebook
|
||||
omniauth-openid
|
||||
omniauth-windowslive
|
||||
openstreetmap-i18n-js (>= 3.0.0.rc5.3)
|
||||
openstreetmap-omniauth-google-oauth2 (>= 0.2.6.1)
|
||||
paperclip (~> 4.0)
|
||||
pg
|
||||
|
|
|
@ -11,28 +11,14 @@ module I18n
|
|||
end
|
||||
|
||||
module JS
|
||||
class << self
|
||||
def make_ordered(unordered)
|
||||
ordered = ActiveSupport::OrderedHash.new
|
||||
|
||||
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
|
||||
class FallbackLocales
|
||||
def default_fallbacks_with_validation
|
||||
default_fallbacks_without_validation.select do |locale|
|
||||
::I18n.available_locales.include?(locale)
|
||||
end
|
||||
end
|
||||
|
||||
ordered
|
||||
end
|
||||
|
||||
def filtered_translations_with_order
|
||||
make_ordered(filtered_translations_without_order)
|
||||
end
|
||||
|
||||
alias_method_chain :filtered_translations, :order
|
||||
alias_method_chain :default_fallbacks, :validation
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue