]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5329 Format date and action
authorJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 20 Jun 2014 10:09:57 +0000 (12:09 +0200)
committerJulien Lancelot <julien.lancelot@sonarsource.com>
Fri, 20 Jun 2014 10:14:12 +0000 (12:14 +0200)
sonar-core/src/main/resources/org/sonar/l10n/core.properties
sonar-server/src/main/java/org/sonar/server/ui/JRubyI18n.java
sonar-server/src/main/webapp/WEB-INF/app/views/profiles/changelog2.html.erb
sonar-server/src/test/java/org/sonar/server/ui/JRubyI18nTest.java

index 5d0a530435187583af51aee34038e45668dfd565..f74268f63862d92be0052bfd6a8b95eaa83fa677 100644 (file)
@@ -1587,8 +1587,6 @@ quality_profiles.projects_warning=List of projects explicitly associated to this
 quality_profiles.including_x_overriding.suffix=, incl. {0} overriding
 quality_profiles.set_parent=Set parent
 quality_profiles.inherit_rules_from_profile=Inherit rules configuration from the profile
-quality_profiles.changelog.empty=No changes have been done.
-quality_profiles.changelog_from=Changelog from
 quality_profiles.no_version=no version
 quality_profiles.last_version_x_with_date=last version {0} ({1})
 quality_profiles.version_x_with_date=version {0} ({1})
@@ -1624,6 +1622,12 @@ quality_profiles.including=including
 quality_profiles.deprecated=deprecated
 quality_profiles.manage_rules_tooltip=Manage rules of this profile
 quality_profiles.see_rules_tooltip=See rules of this profile
+quality_profiles.changelog.empty=No changes have been done.
+quality_profiles.changelog_from=Changelog from
+quality_profiles.changelog.activated=Activated
+quality_profiles.changelog.deactivated=Deactivated
+quality_profiles.changelog.updated=Updated
+
 
 #------------------------------------------------------------------------------
 #
index 561ffc20dfd28fce5060e2af1ddbec3da88dc9a8..3fe51df9928fb4d252db8e91ad497507e3891585 100644 (file)
@@ -98,4 +98,8 @@ public class JRubyI18n implements ServerComponent {
     return formatDuration(Duration.create(duration), format);
   }
 
+  public String formatDateTime(Date date) {
+    return i18n.formatDateTime(UserSession.get().locale(), date);
+  }
+
 }
index 6f93e74a64345af2352622660d101ebb62326be9..05cf3cf8ca243409bedb6a636c78b65154db70f9 100644 (file)
         @changes.each do |change|
       %>
       <tr class="<%= cycle('even', 'odd') -%>">
-        <td valign="top" width="1%" nowrap><%= Api::Utils.format_date(change.time()) -%></td>
+        <%
+           action = change.action()
+           action_message = message('quality_profiles.changelog.' + action.downcase) if action
+        %>
+        <td valign="top" width="1%" nowrap><%= Internal.i18n.formatDateTime(change.time()) -%></td>
         <td valign="top" width="1%" nowrap><%= change.authorName() ? change.authorName() : change.login() ? !change.login().emtpy? : 'System' %></td>
-        <td valign="top" width="1%" nowrap><%= change.action() %></td>
+        <td valign="top" width="1%" nowrap><%= action_message %></td>
         <td valign="top"><%= change.ruleName() ? change.ruleName() : change.ruleKey() %></td>
         <td valign="top"></td>
       </tr>
index 33dffa7601cd5fe8f9d768ffa7210165099de3d5..f2e56ccbe1267dc68fb81fc4b6d39829268ec5ea 100644 (file)
@@ -109,4 +109,11 @@ public class JRubyI18nTest {
     verify(durations).format(any(Locale.class), eq(Duration.create(10L)), eq(Durations.DurationFormat.SHORT));
   }
 
+  @Test
+  public void format_date_time() throws Exception {
+    Date date = new Date();
+    jRubyI18n.formatDateTime(date);
+    verify(i18n).formatDateTime(any(Locale.class), eq(date));
+  }
+
 }