]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-6427 SONAR-6428 Fix l10n of dashboard titles
authorJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Thu, 7 May 2015 15:33:10 +0000 (17:33 +0200)
committerJean-Baptiste Lievremont <jean-baptiste.lievremont@sonarsource.com>
Wed, 13 May 2015 13:25:09 +0000 (15:25 +0200)
server/sonar-server/src/main/java/org/sonar/server/ui/ws/ComponentNavigationAction.java
server/sonar-web/src/main/hbs/nav/nav-context-navbar.hbs
server/sonar-web/src/main/hbs/nav/nav-global-navbar.hbs
server/sonar-web/src/main/js/common/handlebars-extensions.js

index dfa22076e81f2e0d5246b6bec6e59fda80f25c54..07f57d8aaffce345f653937ee17823e5727d83cc 100644 (file)
@@ -197,7 +197,7 @@ public class ComponentNavigationAction implements NavigationAction {
     for (DashboardDto dashboard : dashboards) {
       json.beginObject()
         .prop("key", dashboard.getId())
-        .prop("name", i18n.message(locale, String.format("dashboard.%s.name", dashboard.getName()), dashboard.getName()))
+        .prop("name", dashboard.getName())
         .endObject();
     }
     json.endArray();
index 730f20a001c301cebf8c03ee974af6af6ffe142a..86938a5236b638f419396e425f111c9f25f4ba07 100644 (file)
@@ -97,7 +97,7 @@
         <li class="dropdown-header">{{t 'layout.dashboards'}}</li>
         {{#withoutFirst component.dashboards}}
           <li>
-            <a href="{{componentDashboardPermalink ../component.key key}}">{{name}}</a>
+            <a href="{{componentDashboardPermalink ../component.key key}}">{{dashboardL10n name}}</a>
           </li>
         {{/withoutFirst}}
         {{#if canManageContextDashboards}}
index 806fceb056b41de647620fa7cc85a913a7de05b3..fcaf9cc2672906b3fe026f3f6cc064201c2477c7 100644 (file)
@@ -18,7 +18,7 @@
       <ul class="dropdown-menu">
         {{#each globalDashboards}}
           <li>
-            <a href="{{link '/dashboard/index?did=' key}}">{{name}}</a>
+            <a href="{{link '/dashboard/index?did=' key}}">{{dashboardL10n name}}</a>
           </li>
         {{/each}}
         {{#if canManageGlobalDashboards}}
index f6cb754d6665018d5ec6bd758c4ff93355e773b3..610d5425dc2fe580ea08d6f11bab1bcd41635783 100644 (file)
     return window.formatMeasureVariation(measure, type);
   });
 
+  Handlebars.registerHelper('dashboardL10n', function (dashboardName) {
+    var l10nKey = 'dashboard.' + dashboardName + '.name';
+    var l10nLabel = window.t(l10nKey);
+    if (l10nLabel !== l10nKey) {
+      return l10nLabel;
+    } else {
+      return dashboardName;
+    }
+  });
+
 })();