diff options
author | simonbrandhof <simon.brandhof@gmail.com> | 2011-07-25 20:32:05 +0200 |
---|---|---|
committer | simonbrandhof <simon.brandhof@gmail.com> | 2011-07-25 21:53:57 +0200 |
commit | 3380cba1de57f48e535de91e0c98c16030a36fa8 (patch) | |
tree | d3d82e78ae20b7508771e22eb5a475c1e2dea3e0 /sonar-server | |
parent | e7675ba5c8c7d6bb7550fba092dfb1a9abd3ec5c (diff) | |
download | sonarqube-3380cba1de57f48e535de91e0c98c16030a36fa8.tar.gz sonarqube-3380cba1de57f48e535de91e0c98c16030a36fa8.zip |
SONAR-75 define locale for violation messages
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/i18n_controller.rb | 55 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/helpers/i18n_helper.rb | 61 |
2 files changed, 0 insertions, 116 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/i18n_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/i18n_controller.rb deleted file mode 100644 index c5ec6fd0702..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/i18n_controller.rb +++ /dev/null @@ -1,55 +0,0 @@ -# -# Sonar, entreprise quality control tool. -# Copyright (C) 2008-2011 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# - -require "json" - -class I18nController < ApplicationController - - def index - render :text => "Use one of the following:<br><ul>" + - "<li>/i18n/unknown_keys?format=text|json</li>" + - "</ul>" - end - - # - # GET /i18n/unknown_keys - # - def unknown_keys - output = "" - properties = i18n_manager.unknown_keys - - properties.keys.sort.each { |key| output += "#{key}=#{properties[key]}\n" } - - output = "# No unknown keys" if output.empty? - - respond_to do |format| - format.json { render :json => JSON(properties) } - format.xml { render :xml => xml_not_supported } - format.text { render :text => output } - end - end - - private - - def i18n_manager - java_facade.getComponentByClassname('core', 'org.sonar.plugins.core.i18n.I18nManager') - end - -end
\ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/i18n_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/i18n_helper.rb deleted file mode 100644 index d6a764ffd83..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/i18n_helper.rb +++ /dev/null @@ -1,61 +0,0 @@ -# modify it under the terms of the GNU Lesser General Public - # License as published by the Free Software Foundation; either - # version 3 of the License, or (at your option) any later version. - # - # Sonar is distributed in the hope that it will be useful, - # but WITHOUT ANY WARRANTY; without even the implied warranty of - # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - # Lesser General Public License for more details. - # - # You should have received a copy of the GNU Lesser General Public - # License along with Sonar; if not, write to the Free Software - # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 - # -module I18nHelper - - def self.java_locale() - locale_parts = I18n.locale.to_s.split('-') - return java.util.Locale.new(locale_parts[0]) if locale_parts.size == 1 - return java.util.Locale.new(locale_parts[0], locale_parts[1]) if locale_parts.size >= 2 - end - - def self.i18n - Java::OrgSonarServerUi::JRubyFacade.getInstance().getI18n() - end - - def self.translation(key, defaultText, *objects) - i18n.translation(java_locale(), key, defaultText, objects.to_java) - end - - def self.trans_widget(widget, key, default_text, *objects) - i18n.translation(java_locale(), "view." + widget.widget_key + "." + key, default_text, objects.to_java) - end - - def self.trans_page(view_id, key, default_text, *objects) - i18n.translation(java_locale(), "view." + view_id + "." + key, default_text, objects.to_java) - end - - def self.trans_tab(view_id, key, default_text, *objects) - i18n.translation(java_locale(), "view." + view_id + "." + key, default_text, objects.to_java) - end - - def self.trans_column(column_key, default_text, *objects) - i18n.translation(java_locale(), "general_columns." + column_key, default_text, objects.to_java) - end - - def self.trans_app_view(path, key, default_text, *objects) - i18n.translation(java_locale(), "app.view." + path + "." + key, default_text, objects.to_java) - end - - def self.trans_app_helper(path, key, default_text, *objects) - i18n.translation(java_locale(), "app.helper." + path + "." + key, default_text, objects.to_java) - end - - def self.trans_app_controller(path, key, default_text, *objects) - i18n.translation(java_locale(), "app.controller." + path + "." + key, default_text, objects.to_java) - end - - def self.trans_app_model(path, key, default_text, *objects) - i18n.translation(java_locale(), "app.model." + path + "." + key, default_text, objects.to_java) - end -end
\ No newline at end of file |