Merge pull request #3675 from ulferts/fix/number_localization

Fix/number localization
pull/3686/head
Oliver Günther 9 years ago
commit 9becc5e9e7
  1. 6
      frontend/app/openproject-app.js
  2. 1
      frontend/app/work_packages/services/index.js
  3. 4
      frontend/app/work_packages/services/work-package-field-service.js

@ -44,9 +44,9 @@ require('angular-animate');
require('angular-aria');
require('angular-modal');
if (I18n.locale === 'de') {
require('angular-i18n/angular-locale_de-de');
}
// depends on the html element having a 'lang' attribute
var documentLang = angular.element('html').attr('lang') || 'en';
require('angular-i18n/angular-locale_' + documentLang + '.js');
require('angular-ui-router');

@ -68,6 +68,7 @@ angular.module('openproject.workPackages.services')
'$http',
'$rootScope',
'$timeout',
'$filter',
'HookService',
'NotificationsService',
'EditableFieldsState',

@ -34,6 +34,7 @@ module.exports = function(
$http,
$rootScope,
$timeout,
$filter,
HookService,
NotificationsService,
EditableFieldsState
@ -380,7 +381,8 @@ module.exports = function(
if (schema.props[field]) {
if (schema.props[field].type === 'Duration') {
var hours = moment.duration(value).asHours();
return I18n.t('js.units.hour', { count: hours.toFixed(2) });
var formattedHours = $filter('number')(hours, 2);
return I18n.t('js.units.hour', { count: formattedHours });
}
if (schema.props[field].type === 'Boolean') {

Loading…
Cancel
Save