001 /* 002 * SonarQube, open source software quality management tool. 003 * Copyright (C) 2008-2014 SonarSource 004 * mailto:contact AT sonarsource DOT com 005 * 006 * SonarQube is free software; you can redistribute it and/or 007 * modify it under the terms of the GNU Lesser General Public 008 * License as published by the Free Software Foundation; either 009 * version 3 of the License, or (at your option) any later version. 010 * 011 * SonarQube is distributed in the hope that it will be useful, 012 * but WITHOUT ANY WARRANTY; without even the implied warranty of 013 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 014 * Lesser General Public License for more details. 015 * 016 * You should have received a copy of the GNU Lesser General Public License 017 * along with this program; if not, write to the Free Software Foundation, 018 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 019 */ 020 package org.sonar.api.i18n; 021 022 import org.sonar.api.BatchComponent; 023 import org.sonar.api.ServerComponent; 024 import org.sonar.api.rules.Rule; 025 026 import javax.annotation.CheckForNull; 027 028 import java.util.Locale; 029 030 /** 031 * {@link I18n}-companion component that provides translation facilities for rule names, descriptions and parameter names. 032 * 033 * @since 3.2 034 * @deprecated in 4.1. Rules are not localized anymore. See http://jira.codehaus.org/browse/SONAR-4885 035 */ 036 @Deprecated 037 public interface RuleI18n extends ServerComponent, BatchComponent { 038 039 /** 040 * Returns the localized name of the rule identified by its repository key and rule key. 041 * <br> 042 * If the name is not found in the given locale, then the default name is returned (the English one). 043 * This method could return null if no default name found. This is the cause for instance the copies rules. 044 * 045 * @param repositoryKey the repository key 046 * @param ruleKey the rule key 047 * @param locale not used 048 * @return the translated name of the rule, or the default English one if the given locale is not supported, or null 049 * @deprecated since 4.1. Rules are not localized anymore. See http://jira.codehaus.org/browse/SONAR-4885 050 */ 051 @Deprecated 052 @CheckForNull 053 String getName(String repositoryKey, String ruleKey, Locale locale); 054 055 /** 056 * Returns the name of the rule identified by its repository key and rule key. 057 * <br> 058 * This method could return null if no default name found. This is the cause for instance the copies rules. 059 * 060 * @param repositoryKey the repository key 061 * @param ruleKey the rule key 062 * @return the nullable name of the rule 063 * @since 4.1 064 */ 065 @CheckForNull 066 String getName(String repositoryKey, String ruleKey); 067 068 /** 069 * Returns the localized name or the name of the rule. 070 * <br> 071 * If the name is not found in the given locale, then the default name is returned (the English one). 072 * It the default name is not found, then the rule name is returned. 073 * 074 * @param rule the rule 075 * @param locale the locale to translate into 076 * @return the translated name of the rule, or the default English one if the given locale is not supported, or the rule name. 077 * @deprecated since 4.1. Rules are not localized anymore. See http://jira.codehaus.org/browse/SONAR-4885 078 */ 079 @Deprecated 080 @CheckForNull 081 String getName(Rule rule, Locale locale); 082 083 /** 084 * Returns the name of the rule. 085 * <br> 086 * It the default name is not found, then the rule name is returned. 087 * 088 * @param rule the rule 089 * @return the nullable name of the rule 090 * @since 4.1 091 */ 092 @CheckForNull 093 String getName(Rule rule); 094 095 /** 096 * Returns the localized description of the rule identified by its repository key and rule key. 097 * <br> 098 * If the description is not found in the given locale, then the default description is returned (the English one). 099 * As a rule must have a description (this is a constraint in Sonar), this method never returns null. 100 * 101 * @param repositoryKey the repository key 102 * @param ruleKey the rule key 103 * @param locale the locale to translate into 104 * @return the translated description of the rule, or the default English one if the given locale is not supported 105 * @deprecated since 4.1. Rules are not localized anymore. See http://jira.codehaus.org/browse/SONAR-4885 106 */ 107 @Deprecated 108 String getDescription(String repositoryKey, String ruleKey, Locale locale); 109 110 /** 111 * Returns the description of the rule identified by its repository key and rule key. 112 * <br> 113 * As a rule must have a description (this is a constraint in SonarQube), this method never returns null. 114 * 115 * @param repositoryKey the repository key 116 * @param ruleKey the rule key 117 * @return the description of the rule 118 * @since 4.1 119 */ 120 String getDescription(String repositoryKey, String ruleKey); 121 122 /** 123 * Returns the localized name of the rule parameter identified by the rules's key and repository key, and by the parameter key. 124 * <br> 125 * If the name is not found in the given locale, then the English translation is searched and return if found. Otherwise, 126 * this method returns null (= if no translation can be found). 127 * 128 * @param repositoryKey the repository key 129 * @param ruleKey the rule key 130 * @param paramKey the parameter key 131 * @param locale the locale to translate into 132 * @return the translated name of the rule parameter, or the default English one if the given locale is not supported, or null if 133 * no translation can be found. 134 * @deprecated since 4.1. Rules are not localized anymore. See http://jira.codehaus.org/browse/SONAR-4885 135 */ 136 @Deprecated 137 @CheckForNull 138 String getParamDescription(String repositoryKey, String ruleKey, String paramKey, Locale locale); 139 140 /** 141 * Returns the name of the rule parameter identified by the rules's key and repository key, and by the parameter key. 142 * 143 * @param repositoryKey the repository key 144 * @param ruleKey the rule key 145 * @param paramKey the parameter key 146 * @return the nullable name of the rule parameter 147 * @since 4.1 148 */ 149 @CheckForNull 150 String getParamDescription(String repositoryKey, String ruleKey, String paramKey); 151 152 }