Skip to content
Extraits de code Groupes Projets
Valider 0831ad6e rédigé par Dan Hansen's avatar Dan Hansen Validation de maxwell
Parcourir les fichiers

move i18n.loadLocale to the application template, remove localize controller &...

move i18n.loadLocale to the application template, remove localize controller & helper, renamed localize to get_javascript_strings_for and added it to the application helper
parent ee218ecd
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
...@@ -49,4 +49,10 @@ class ApplicationController < ActionController::Base ...@@ -49,4 +49,10 @@ class ApplicationController < ActionController::Base
end end
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 end
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
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
...@@ -5,9 +5,7 @@ ...@@ -5,9 +5,7 @@
- content_for :head do - content_for :head do
= include_javascripts :home = include_javascripts :home
:javascript
Diaspora.widgets.i18n.loadLocale(#{localize(current_user.language).to_json}, "#{current_user.language}");
.span-15.append-2 .span-15.append-2
= render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count = render 'aspects/no_contacts_message', :aspect => @aspect, :contact_count => @contacts.count
......
...@@ -33,8 +33,10 @@ ...@@ -33,8 +33,10 @@
- unless @landing_page - unless @landing_page
= include_javascripts :main = 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) -if current_user
= javascript_include_tag "vendor/timeago_locale/jquery.timeago.#{I18n.locale.to_s}.js" :javascript
Diaspora.widgets.i18n.loadLocale(#{get_javascript_strings_for(current_user.language).to_json}, "#{current_user.language}");
- if current_user - if current_user
= include_javascripts :flash_socket #unless modern_browser? = include_javascripts :flash_socket #unless modern_browser?
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter