]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-3179 Use naming convention for localization of qualifiers
authorEvgeny Mandrikov <mandrikov@gmail.com>
Thu, 19 Jan 2012 15:15:43 +0000 (19:15 +0400)
committerEvgeny Mandrikov <mandrikov@gmail.com>
Fri, 20 Jan 2012 08:40:41 +0000 (12:40 +0400)
Change localization for "qualifier.BRK" from "Module" to "Sub-project".

plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/resources/DefaultResources.java
plugins/sonar-l10n-en-plugin/src/main/resources/org/sonar/l10n/core.properties
sonar-plugin-api/src/main/java/org/sonar/api/resources/ResourceDefinition.java
sonar-plugin-api/src/test/java/org/sonar/api/resources/ResourceDefinitionTest.java
sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb
sonar-server/src/main/webapp/WEB-INF/app/views/filters/new.html.erb

index 6380431f40dd181b7b011004f253931937f8680c..ab954783c3e110c5dfed78af9db14367915b2bd8 100644 (file)
@@ -32,16 +32,16 @@ public class DefaultResources extends ExtensionProvider implements ServerExtensi
   @Override
   public List<ResourceDefinition> provide() {
     return Arrays.asList(
-        ResourceDefinition.builder(Qualifiers.VIEW).setName("view").build(),
-        ResourceDefinition.builder(Qualifiers.SUBVIEW).setName("sub_view").build(),
-        ResourceDefinition.builder(Qualifiers.PROJECT).setName("project").build(),
-        ResourceDefinition.builder(Qualifiers.MODULE).setName("sub_project").build(),
-        ResourceDefinition.builder(Qualifiers.DIRECTORY).setName("directory").build(),
-        ResourceDefinition.builder(Qualifiers.PACKAGE).setName("package").build(),
-        ResourceDefinition.builder(Qualifiers.FILE).setName("file").build(),
-        ResourceDefinition.builder(Qualifiers.CLASS).setName("class").build(),
-        ResourceDefinition.builder(Qualifiers.UNIT_TEST_FILE).setName("unit_test").build(),
-        ResourceDefinition.builder(Qualifiers.LIBRARY).setName("library").build());
+        ResourceDefinition.builder(Qualifiers.VIEW).build(),
+        ResourceDefinition.builder(Qualifiers.SUBVIEW).build(),
+        ResourceDefinition.builder(Qualifiers.PROJECT).build(),
+        ResourceDefinition.builder(Qualifiers.MODULE).build(),
+        ResourceDefinition.builder(Qualifiers.DIRECTORY).build(),
+        ResourceDefinition.builder(Qualifiers.PACKAGE).build(),
+        ResourceDefinition.builder(Qualifiers.FILE).build(),
+        ResourceDefinition.builder(Qualifiers.CLASS).build(),
+        ResourceDefinition.builder(Qualifiers.UNIT_TEST_FILE).build(),
+        ResourceDefinition.builder(Qualifiers.LIBRARY).build());
   }
 
 }
index a3e5a58a63174454f0de23a932179653bc4ead6d..00435931bb270e5d1ad51fa5298498453a295eb3 100644 (file)
@@ -211,7 +211,7 @@ time_changes=Time changes
 #------------------------------------------------------------------------------
 
 qualifier.TRK=Project
-qualifier.BRC=Module
+qualifier.BRC=Sub-project
 qualifier.DIR=Directory
 qualifier.PAC=Package
 qualifier.VW=View
@@ -221,7 +221,7 @@ qualifier.CLA=File
 qualifier.UTS=Unit Test File
 
 qualifiers.TRK=Projects
-qualifiers.BRC=Modules
+qualifiers.BRC=Sub-projects
 qualifiers.DIR=Directories
 qualifiers.PAC=Packages
 qualifiers.VW=Views
index 899ba0b6c8475bed636b12994e63ef613b0b4d36..09a057373cc1905e4b2caa967cdd0dc38d89a1e6 100644 (file)
@@ -32,7 +32,6 @@ public final class ResourceDefinition implements ServerExtension {
 
   public static class Builder {
     private String qualifier;
-    private String name;
     private String iconPath;
     private boolean availableForFilters = false;
 
@@ -40,14 +39,6 @@ public final class ResourceDefinition implements ServerExtension {
       this.qualifier = qualifier;
     }
 
-    /**
-     * @param name name which would be used for localization
-     */
-    public Builder setName(String name) {
-      this.name = name;
-      return this;
-    }
-
     /**
      * @param iconPath path to icon, relative to context of web-application (e.g. "/images/q/DIR.png")
      */
@@ -62,13 +53,10 @@ public final class ResourceDefinition implements ServerExtension {
     }
 
     public ResourceDefinition build() {
-      if (Strings.isNullOrEmpty(name)) {
-        name = qualifier;
-      }
       if (Strings.isNullOrEmpty(iconPath)) {
         iconPath = "/images/q/" + qualifier + ".png";
       }
-      return new ResourceDefinition(qualifier, name, iconPath, availableForFilters);
+      return new ResourceDefinition(qualifier, iconPath, availableForFilters);
     }
   }
 
@@ -79,13 +67,11 @@ public final class ResourceDefinition implements ServerExtension {
   }
 
   private final String qualifier;
-  private final String name;
   private final String iconPath;
   private final boolean availableForFilters;
 
-  private ResourceDefinition(String qualifier, String name, String iconPath, boolean availableForFilters) {
+  private ResourceDefinition(String qualifier, String iconPath, boolean availableForFilters) {
     this.qualifier = qualifier;
-    this.name = name;
     this.iconPath = iconPath;
     this.availableForFilters = availableForFilters;
   }
@@ -94,10 +80,6 @@ public final class ResourceDefinition implements ServerExtension {
     return qualifier;
   }
 
-  public String getName() {
-    return name;
-  }
-
   public String getIconPath() {
     return iconPath;
   }
index 852919406b1d3eab916ab830dd976a4ae7978ec1..c18d59a7f584352daf0819292b062048ceeda9b8 100644 (file)
@@ -31,7 +31,6 @@ public class ResourceDefinitionTest {
     ResourceDefinition def = ResourceDefinition.builder("qualifier")
         .build();
     assertThat(def.getQualifier(), is("qualifier"));
-    assertThat(def.getName(), is("qualifier"));
     assertThat(def.getIconPath(), is("/images/q/qualifier.png"));
   }
 
@@ -39,10 +38,8 @@ public class ResourceDefinitionTest {
   public void shouldCreate() {
     ResourceDefinition def = ResourceDefinition.builder("qualifier")
         .setIconPath("/custom-icon.png")
-        .setName("custom-name")
         .build();
     assertThat(def.getQualifier(), is("qualifier"));
-    assertThat(def.getName(), is("custom-name"));
     assertThat(def.getIconPath(), is("/custom-icon.png"));
   }
 
index 4bdd5be00abfce4aaf226835f214df6a3c6dfd7b..3d69c422203dbce8f8b7f328d400393598810067 100644 (file)
@@ -42,7 +42,7 @@ module ApplicationHelper
     qualifier=(object.respond_to?('qualifier') ? object.qualifier : object.to_s)
     if qualifier
       definition = Java::OrgSonarServerUi::JRubyFacade.getInstance().getResourceDefinition(qualifier)
-      image_tag(definition.getIconPath(), :alt => message(definition.getName()))
+      image_tag(definition.getIconPath(), :alt => message("qualifier.#{qualifier}"))
     else
       image_tag('e16.gif')
     end
index d4c9a75eab5fc41473f48effd2539475e5c87df5..dc1b9b21f28d033d654583541b7c7448e5a1e63c 100644 (file)
@@ -50,32 +50,32 @@ table#columns td {
             <% qualifiers=(@filter.criterion('qualifier') ? @filter.criterion('qualifier').text_values : []) %>
 
               <% if controller.java_facade.hasPlugin('views') %>
-                <input type="checkbox" name="qualifiers[]" value="VW" <%= 'checked' if qualifiers.include?('VW') -%> id="q-VW"></input> <label for="q-VW"><%= message('views') -%></label>
+                <input type="checkbox" name="qualifiers[]" value="VW" <%= 'checked' if qualifiers.include?('VW') -%> id="q-VW"></input> <label for="q-VW"><%= message('qualifiers.VW') -%></label>
                 <span class="spacer"> </span>
 
-                <input type="checkbox" name="qualifiers[]" value="SVW" <%= 'checked' if qualifiers.include?('SVW') -%> id="q-SVW"></input> <label for="q-SVW"><%= message('sub_views') -%></label>
+                <input type="checkbox" name="qualifiers[]" value="SVW" <%= 'checked' if qualifiers.include?('SVW') -%> id="q-SVW"></input> <label for="q-SVW"><%= message('qualifiers.SVW') -%></label>
                 <span class="spacer"> </span>
               <% end %>
 
-              <input type="checkbox" name="qualifiers[]" value="TRK" <%= 'checked' if qualifiers.include?('TRK') -%> id="q-TRK"></input> <label for="q-TRK"><%= message('projects') -%></label>
+              <input type="checkbox" name="qualifiers[]" value="TRK" <%= 'checked' if qualifiers.include?('TRK') -%> id="q-TRK"></input> <label for="q-TRK"><%= message('qualifiers.TRK') -%></label>
               <span class="spacer"> </span>
 
-              <input type="checkbox" name="qualifiers[]" value="BRC" <%= 'checked' if qualifiers.include?('BRC') -%> id="q-BRC"></input> <label for="q-BRC"><%= message('sub_projects') -%></label>
+              <input type="checkbox" name="qualifiers[]" value="BRC" <%= 'checked' if qualifiers.include?('BRC') -%> id="q-BRC"></input> <label for="q-BRC"><%= message('qualifiers.BRC') -%></label>
               <span class="spacer"> </span>
 
-              <input type="checkbox" name="qualifiers[]" value="DIR,PAC" <%= 'checked' if qualifiers.include?('DIR') -%> id="q-DIR"></input> <label for="q-DIR"><%= message('directories') -%>/<%= message('packages') -%></label>
+              <input type="checkbox" name="qualifiers[]" value="DIR,PAC" <%= 'checked' if qualifiers.include?('DIR') -%> id="q-DIR"></input> <label for="q-DIR"><%= message('qualifiers.DIR') -%>/<%= message('qualifiers.PAC') -%></label>
               <span class="spacer"> </span>
 
-              <input type="checkbox" name="qualifiers[]" value="FIL,CLA" <%= 'checked' if qualifiers.include?('FIL') -%> id="q-FIL"></input> <label for="q-FIL"><%= message('files') -%>/<%= message('classes') -%></label>
+              <input type="checkbox" name="qualifiers[]" value="FIL,CLA" <%= 'checked' if qualifiers.include?('FIL') -%> id="q-FIL"></input> <label for="q-FIL"><%= message('qualifiers.FIL') -%></label>
               <span class="spacer"> </span>
 
-              <input type="checkbox" name="qualifiers[]" value="UTS" <%= 'checked' if qualifiers.include?('UTS') -%> id="q-UTS"></input> <label for="q-UTS"><%= message('unit_tests') -%></label>
+              <input type="checkbox" name="qualifiers[]" value="UTS" <%= 'checked' if qualifiers.include?('UTS') -%> id="q-UTS"></input> <label for="q-UTS"><%= message('qualifiers.UTS') -%></label>
               <span class="spacer"> </span>
 
               <% for desc in controller.java_facade.getResourceDefinitionsForFilter()
                    qualifier = desc.getQualifier() %>
                 <input type="checkbox" name="qualifiers[]" value="<%= qualifier -%>" <%= 'checked' if qualifiers.include?(qualifier) -%> id="q-<%= qualifier -%>"></input>
-                <label for="q-<%= qualifier -%>"><%= message(desc.getName()) -%></label>
+                <label for="q-<%= qualifier -%>"><%= message("qualifiers.#{qualifier}") -%></label>
                 <span class="spacer"> </span>
               <% end %>
           </td>