diff --git a/Gemfile b/Gemfile index b5547dc9f..a2c3670e5 100644 --- a/Gemfile +++ b/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" diff --git a/Gemfile.lock b/Gemfile.lock index 08e32900e..85509ecaa 100644 --- a/Gemfile.lock +++ b/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 diff --git a/config/initializers/i18n.rb b/config/initializers/i18n.rb index 1ee7716e6..91efa2557 100644 --- a/config/initializers/i18n.rb +++ b/config/initializers/i18n.rb @@ -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 - end + class FallbackLocales + def default_fallbacks_with_validation + default_fallbacks_without_validation.select do |locale| + ::I18n.available_locales.include?(locale) 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