aboutsummaryrefslogtreecommitdiffstats
path: root/sonar-plugin-api
diff options
context:
space:
mode:
authorJulien Lancelot <julien.lancelot@gmail.com>2012-12-04 11:59:12 +0100
committerJulien Lancelot <julien.lancelot@gmail.com>2012-12-04 11:59:12 +0100
commit034013c4aefee3ffbf158caf1489d261ae5bf4b9 (patch)
tree73f6e5a485e4a0498439567f31ae5b0ae08eb082 /sonar-plugin-api
parenta0b9f5612d661375fc6fa8e8c97a9b0a5dcd7ff7 (diff)
downloadsonarqube-034013c4aefee3ffbf158caf1489d261ae5bf4b9.tar.gz
sonarqube-034013c4aefee3ffbf158caf1489d261ae5bf4b9.zip
SONARIDE-334 Title is not displayed for some rules
RuleI18nManager has now a new method to get the rule name by searching the name in the i18n, and then if not found return the rule name property.
Diffstat (limited to 'sonar-plugin-api')
-rw-r--r--sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java17
1 files changed, 15 insertions, 2 deletions
diff --git a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java
index a2a083a787f..4afdb625394 100644
--- a/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java
+++ b/sonar-plugin-api/src/main/java/org/sonar/api/i18n/RuleI18n.java
@@ -21,6 +21,7 @@ package org.sonar.api.i18n;
import org.sonar.api.BatchComponent;
import org.sonar.api.ServerComponent;
+import org.sonar.api.rules.Rule;
import java.util.Locale;
@@ -35,16 +36,28 @@ public interface RuleI18n extends ServerComponent, BatchComponent {
* Returns the localized name of the rule identified by its repository key and rule key.
* <br>
* If the name is not found in the given locale, then the default name is returned (the English one).
- * As a rule must have a name (this is a constraint in Sonar), this method never returns null.
+ * This method could return null if no default name found. This is the cause for instance the copies rules.
*
* @param repositoryKey the repository key
* @param ruleKey the rule key
* @param locale the locale to translate into
- * @return the translated name of the rule, or the default English one if the given locale is not supported
+ * @return the translated name of the rule, or the default English one if the given locale is not supported, or null
*/
String getName(String repositoryKey, String ruleKey, Locale locale);
/**
+ * Returns the localized name or the name of the rule.
+ * <br>
+ * If the name is not found in the given locale, then the default name is returned (the English one).
+ * It the default name is not found, then the rule name is returned.
+ *
+ * @param rule the rule
+ * @param locale the locale to translate into
+ * @return the translated name of the rule, or the default English one if the given locale is not supported, or the rule name.
+ */
+ String getName(Rule rule, Locale locale);
+
+ /**
* Returns the localized description of the rule identified by its repository key and rule key.
* <br>
* If the description is not found in the given locale, then the default description is returned (the English one).