diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0b644dd59f4a1dd08b0823bc7a005c7ba8c9fe06..9b1f86ab77403931b5bc8ba0547b4bd8d788fa23 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -49,4 +49,10 @@ class ApplicationController < ActionController::Base end end + def get_javascript_strings_for language + yml_path = File.join(Rails.root, "config/locales/diaspora/", "#{language}.yml") + yaml = YAML::load IO.read(yml_path) + + yaml[language]["javascripts"] + end end diff --git a/app/controllers/localize_controller.rb b/app/controllers/localize_controller.rb deleted file mode 100644 index 29f07299fcdbce21fe434b218e4ac8a2058cc45f..0000000000000000000000000000000000000000 --- a/app/controllers/localize_controller.rb +++ /dev/null @@ -1,13 +0,0 @@ -class LocalizeController < ApplicationController - before_filter :authenticate_user! - - include LocalizeHelper - - def show - if current_user - render :json => localize current_user.language - else - redirect_to aspects_path - end - end -end \ No newline at end of file diff --git a/app/helpers/localize_helper.rb b/app/helpers/localize_helper.rb deleted file mode 100644 index 174c359eae302acd0b688c419b51a40efd91f3f1..0000000000000000000000000000000000000000 --- a/app/helpers/localize_helper.rb +++ /dev/null @@ -1,8 +0,0 @@ -module LocalizeHelper - def localize language - yml_path = File.join(Rails.root, "config/locales/diaspora/", "#{language}.yml") - yaml = YAML::load IO.read(yml_path) - - yaml[language]["javascripts"] - end -end \ No newline at end of file diff --git a/app/views/aspects/index.html.haml b/app/views/aspects/index.html.haml index a68daec9ed98de2a63300a1e1f82041bfee7d71d..723d4f4f7e5f415f9f42893c6fe5e8a9fafcd1f4 100644 --- a/app/views/aspects/index.html.haml +++ b/app/views/aspects/index.html.haml @@ -5,9 +5,7 @@ - content_for :head do = include_javascripts :home - :javascript - Diaspora.widgets.i18n.loadLocale(#{localize(current_user.language).to_json}, "#{current_user.language}"); - + .span-15.append-2 = render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count diff --git a/app/views/layouts/application.html.haml b/app/views/layouts/application.html.haml index 44abd7cdfbf7f8c810582b7527d9e0d0d6ddbf2f..0a4a141c8e072efef12a1bdef6c063155110749c 100644 --- a/app/views/layouts/application.html.haml +++ b/app/views/layouts/application.html.haml @@ -33,8 +33,10 @@ - unless @landing_page = include_javascripts :main - - if ["cz", "da", "de", "el", "es", "fr", "he", "hu", "id", "it", "ja", "ko", "nl", "pl", "pt", "ro", "ru", "sv", "zh-CN"].include?(I18n.locale.to_s) - = javascript_include_tag "vendor/timeago_locale/jquery.timeago.#{I18n.locale.to_s}.js" + -if current_user + :javascript + Diaspora.widgets.i18n.loadLocale(#{get_javascript_strings_for(current_user.language).to_json}, "#{current_user.language}"); + - if current_user = include_javascripts :flash_socket #unless modern_browser?