]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-2589 Modification of all web ruby templates to use bundles
authorFabrice Bellingard <bellingard@gmail.com>
Thu, 21 Jul 2011 09:03:27 +0000 (11:03 +0200)
committerFabrice Bellingard <bellingard@gmail.com>
Thu, 21 Jul 2011 09:03:27 +0000 (11:03 +0200)
- Add I18n to session messages (log in, log out, ...)
- Add I18n to flash notices
- Add I18n to cloud page
- Add I18n to maintenance page

plugins/sonar-i18n-en-plugin/src/main/resources/org/sonar/i18n/core.properties
sonar-server/src/main/webapp/WEB-INF/app/controllers/application_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/controllers/sessions_controller.rb
sonar-server/src/main/webapp/WEB-INF/app/views/cloud/index.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_nolayout.html.erb
sonar-server/src/main/webapp/WEB-INF/app/views/maintenance/index.html.erb

index ce0be9f946690395dd22ef831e6b18c1b0bb941a..11fdf44f9d7d8c3b487913e9015c6ed62c4422fe 100644 (file)
@@ -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=<p>Whilst waiting, you might want to check <a href="http://sonar-plugins.codehaus.org">new plugins</a> to extend the current functionality. </p><p>If you are an administrator and have no idea why this message is showing, you should read the <a href="http://docs.codehaus.org/display/SONAR/Upgrade+guide">upgrade guide</a>.</p>
+
+
 #------------------------------------------------------------------------------
 #
 # METRIC DOMAINS
index af52d5bf243051f8e6ba3fc1f720288475bd073f..0c06549b0fd29302237435c104e57b14ba55cefd 100644 (file)
@@ -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
index 5f9b1dc9a97d267f1e5162569896762a852f97e9..fc273b333704ed8675c0ee90c6ec4d85de9663fa 100644 (file)
@@ -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
index 609dc6fcff1ad75208405ab6f23fa9a707b8fc3f..5edc83b7fc1843dbd1378d7dbd421188a2d94f15 100644 (file)
 <form id="cloudform" action="<%= ApplicationController.root_context -%>/cloud/index/<%= @project.id -%>" method="GET">
   <ul class="headerLine">
     <li>
-      <span>Color:</span>
+      <span><%= message('color') -%>:</span>
       <select name="color" onchange="document.forms['cloudform'].submit()">
         <% if @snapshot.measure('coverage') %>
-          <option value="coverage" <%= 'selected' if @color_metric.key=='coverage' -%>>Coverage</option>
+          <option value="coverage" <%= 'selected' if @color_metric.key=='coverage' -%>><%= message('metric.coverage.name') -%></option>
         <% end %>
-        <option value="violations_density" <%= 'selected' if @color_metric.key=='violations_density' -%>>Rules compliance</option>
+        <option value="violations_density" <%= 'selected' if @color_metric.key=='violations_density' -%>><%= message('metric.violations_density.name') -%></option>
       </select>
     </li>
     <li class="sep"> </li>
     <li>
       <input type="radio" name="size" value="ncloc" <%= 'checked' if @size_metric.key=='ncloc' -%> onclick="document.forms['cloudform'].submit()" id="radio-quick">
-      <label for="radio-quick">Quick wins</label></option>
+      <label for="radio-quick"><%= message('cloud.quick_wins') -%></label></option>
       &nbsp;
       <input type="radio" name="size" value="function_complexity" <%= 'checked' if @size_metric.key=='function_complexity' -%> onclick="document.forms['cloudform'].submit()" id="radio-top">
-      <label for="radio-top">Top risk</label></input>
+      <label for="radio-top"><%= message('cloud.top_risk') -%></label></input>
     </li>
   </ul>
 </form>
index 3b55930addeb822b2f43273c04961c7710890bb9..33aefe64b410a7b357fdd63354d1075ca0f73247 100644 (file)
@@ -98,9 +98,9 @@
      </div>
      <div id="content"  class="with_sidebar">
        <% if @project %><div class="print"><h2><%= @project.name(true) %></h2></div><% end %>
-       <div class="error" id="error" style="display:none"><span id="errormsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('error').hide();return false;">hide</a>]</div>
-       <div class="notice" id="info" style="display:none"><span id="infomsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('info').hide();return false;">hide</a>]</div>
-       <div class="warning" id="warning" style="display:none"><span id="warningmsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('warning').hide();return false;">hide</a>]</div>
+       <div class="error" id="error" style="display:none"><span id="errormsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('error').hide();return false;"><%= message('hide').downcase -%></a>]</div>
+       <div class="notice" id="info" style="display:none"><span id="infomsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('info').hide();return false;"><%= message('hide').downcase -%></a>]</div>
+       <div class="warning" id="warning" style="display:none"><span id="warningmsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('warning').hide();return false;"><%= message('hide').downcase -%></a>]</div>
        <%= yield %>
      </div>
   </div>
index a4fcad6bd6d3b3b935a017a3cfd0568418dc5843..6e20677bf70e9e1eb7e3ad57aefe06f7129d29b1 100644 (file)
@@ -1,7 +1,7 @@
 <div id="body" class="nolayout">
   <% if @snapshot %><div class="print"><h2><%= @snapshot.project.name(true) %></h2></div><% end %>
-  <div class="error" id="error" style="display:none"><span id="errormsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('error').hide();return false;">hide</a>]</div>
-  <div class="warning" id="warning" style="display:none"><span id="warningmsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('warning').hide();return false;">hide</a>]</div>
-  <div class="notice" id="info" style="display:none"><span id="infomsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('info').hide();return false;">hide</a>]</div>
+  <div class="error" id="error" style="display:none"><span id="errormsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('error').hide();return false;"><%= message('hide').downcase -%></a>]</div>
+  <div class="warning" id="warning" style="display:none"><span id="warningmsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('warning').hide();return false;"><%= message('hide').downcase -%></a>]</div>
+  <div class="notice" id="info" style="display:none"><span id="infomsg"></span> &nbsp;&nbsp;[<a href="#" onclick="javascript:$('info').hide();return false;"><%= message('hide').downcase -%></a>]</div>
   <%= yield %>
 </div>
\ No newline at end of file
index b8bee4362ca9430972118d9ecff66334402a5c48..d1b22d6c1996c7274f670a9cd110cb466bf31adb 100644 (file)
@@ -12,7 +12,6 @@
 
 <div id="maintenance">
 <div id="maintenancelogo"><a href="http://www.sonarsource.org"><%= image_tag('sonar.png', :class => 'png') -%></a></div>
-<h1>Sonar is under maintenance. Please <a href="<%= ApplicationController.root_context -%>/">check back</a> later.</h1>
-<p>Whilst waiting, you might want to check <a href="http://sonar-plugins.codehaus.org">new plugins</a> to extend the current functionality. </p>
-<p>If you are an administrator and have no idea why this message is showing, you should read the <a href="http://docs.codehaus.org/display/SONAR/Upgrade+guide">upgrade guide</a>.</p>
+<h1><%= message('maintenance.sonar_is_under_maintenance') -%> <a href="<%= ApplicationController.root_context -%>/"><%= message('maintenance.please_check_back_later') -%></a></h1>
+<%= message('maintenance.more_information') -%>
 </div>
\ No newline at end of file