From: Fabrice Bellingard Date: Thu, 21 Jul 2011 09:03:27 +0000 (+0200) Subject: SONAR-2589 Modification of all web ruby templates to use bundles X-Git-Tag: 2.10~118 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0cc5a607a16d081e160ae2f9ac7d9e7db9141e01;p=sonarqube.git SONAR-2589 Modification of all web ruby templates to use bundles - Add I18n to session messages (log in, log out, ...) - Add I18n to flash notices - Add I18n to cloud page - Add I18n to maintenance page --- diff --git a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties index ce0be9f9466..11fdf44f9d7 100644 --- a/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties +++ b/plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties @@ -274,6 +274,9 @@ org.sonar.plugins.core.duplicationsviewer.DuplicationsViewer.page=Duplications sessions.remember_me=Remember me on this computer sessions.log_in=Log in +session.flash_notice.logged_in=Logged in. +session.flash_notice.authentication_failed=Authentication failed. +session.flash_notice.logged_out=You have been logged out. #------------------------------------------------------------------------------ @@ -484,6 +487,16 @@ time_machine.compare_on_chart=Compare on chart time_machine.set_as_default_for_all_users=Set as default (for all users) +#------------------------------------------------------------------------------ +# +# CLOUDS +# +#------------------------------------------------------------------------------ + +cloud.quick_wins=Quick wins +cloud.top_risk=Top risk + + #------------------------------------------------------------------------------ # # REVIEWS @@ -513,6 +526,17 @@ events.add_an_event=Add an event events.name_required=Name (required) +#------------------------------------------------------------------------------ +# +# MAINTENANCE +# +#------------------------------------------------------------------------------ + +maintenance.sonar_is_under_maintenance=Sonar is under maintenance. +maintenance.please_check_back_later=Please check back later. +maintenance.more_information=

Whilst waiting, you might want to check new plugins to extend the current functionality.

If you are an administrator and have no idea why this message is showing, you should read the upgrade guide.

+ + #------------------------------------------------------------------------------ # # METRIC DOMAINS diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/application_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/application_controller.rb index af52d5bf243..0c06549b0fd 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/application_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/application_controller.rb @@ -94,4 +94,15 @@ class ApplicationController < ActionController::Base return access_denied end end + + # i18n + def message(key, options={}) + default = options[:default] + params = options[:params] + if params.nil? + params=[] + end + Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18nMessage(I18n.locale, key, default, params.to_java) + end + end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/sessions_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/sessions_controller.rb index 5f9b1dc9a97..fc273b33370 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/sessions_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/sessions_controller.rb @@ -20,7 +20,7 @@ ### Sessions Controller from restful_authentication (http://agilewebdevelopment.com/plugins/restful_authentication) class SessionsController < ApplicationController - + layout 'nonav' skip_before_filter :check_authentication @@ -33,10 +33,10 @@ class SessionsController < ApplicationController self.current_user.remember_me cookies[:auth_token] = { :value => self.current_user.remember_token , :expires => self.current_user.remember_token_expires_at } end - flash[:notice] = 'Logged in.' + flash[:notice] = message('session.flash_notice.logged_in') redirect_to(home_path) else - flash.now[:loginerror] = 'Authentication failed.' + flash.now[:loginerror] = message('session.flash_notice.authentication_failed') end end @@ -46,7 +46,7 @@ class SessionsController < ApplicationController self.current_user.forget_me end cookies.delete :auth_token - flash[:notice]='You have been logged out.' + flash[:notice]=message('session.flash_notice.logged_out') redirect_to(home_path) reset_session end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/cloud/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/cloud/index.html.erb index 609dc6fcff1..5edc83b7fc1 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/cloud/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/cloud/index.html.erb @@ -21,21 +21,21 @@
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb index 3b55930adde..33aefe64b41 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb @@ -98,9 +98,9 @@
<% if @project %>

<%= @project.name(true) %>

<% end %> - - - + + + <%= yield %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_nolayout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_nolayout.html.erb index a4fcad6bd6d..6e20677bf70 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_nolayout.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_nolayout.html.erb @@ -1,7 +1,7 @@
<% if @snapshot %>

<%= @snapshot.project.name(true) %>

<% end %> - - - + + + <%= yield %>
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb index b8bee4362ca..d1b22d6c199 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb @@ -12,7 +12,6 @@
-

Sonar is under maintenance. Please check back later.

-

Whilst waiting, you might want to check new plugins to extend the current functionality.

-

If you are an administrator and have no idea why this message is showing, you should read the upgrade guide.

+

<%= message('maintenance.sonar_is_under_maintenance') -%> <%= message('maintenance.please_check_back_later') -%>

+<%= message('maintenance.more_information') -%>
\ No newline at end of file