diff options
Diffstat (limited to 'sonar-server')
-rw-r--r-- | sonar-server/pom.xml | 6 | ||||
-rw-r--r-- | sonar-server/src/main/webapp/WEB-INF/app/controllers/i18n_controller.rb | 64 |
2 files changed, 64 insertions, 6 deletions
diff --git a/sonar-server/pom.xml b/sonar-server/pom.xml index 7d1fe84dcdc..5205ad689de 100644 --- a/sonar-server/pom.xml +++ b/sonar-server/pom.xml @@ -454,12 +454,6 @@ <version>${project.version}</version> <scope>provided</scope> </dependency> - <dependency> - <groupId>org.codehaus.sonar.plugins</groupId> - <artifactId>sonar-i18n-plugin</artifactId> - <version>${project.version}</version> - <scope>provided</scope> - </dependency> </dependencies> </profile> 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 new file mode 100644 index 00000000000..30ba45178db --- /dev/null +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/i18n_controller.rb @@ -0,0 +1,64 @@ +# +# 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 < Api::ApiController + + 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 + begin + 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 + + rescue ApiException => e + render_error(e.msg, e.code) + + rescue Exception => e + logger.error("Fails to execute #{request.url} : #{e.message}") + render_error(e.message) + end + end + + private + + def i18n_manager + java_facade.getComponentByClassname('i18n', 'org.sonar.plugins.core.i18n.I18nManager') + end + +end
\ No newline at end of file |