Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[#67706] Extract translations for number formatter

Tobias Dillmanna40f8e4f39e5
diff --git a/app/models/custom_value/calculated_value_strategy.rb b/app/models/custom_value/calculated_value_strategy.rb
index 5f47edf22f0..33eda03df51 100644
--- a/app/models/custom_value/calculated_value_strategy.rb
+++ b/app/models/custom_value/calculated_value_strategy.rb
@@ -43,15 +43,17 @@ class CustomValue::CalculatedValueStrategy < CustomValue::FormatStrategy
if integer_value?
number_with_delimiter(value.to_i)
else
+ delimiter = I18n.t("number.format.delimiter")
+ separator = I18n.t("number.format.separator")
formatted = number_with_precision(value.to_f,
precision: 3,
strip_insignificant_zeros: true,
- delimiter: I18n.t("number.format.delimiter"),
- separator: I18n.t("number.format.separator"))
+ delimiter:,
+ separator:)
# Ensure at least one decimal place for floats
- if formatted.exclude?(I18n.t("number.format.separator"))
- "#{formatted}#{I18n.t('number.format.separator')}0"
+ if formatted.exclude?(separator)
+ "#{formatted}#{separator}0"
else
formatted
end