Avoid having to store complex object in the default translation file

This make possible for applications to use the safe mode of yaml to
load the translations files.

Fixes #41459.
This commit is contained in:
Rafael Mendonça França 2021-02-18 06:25:56 +00:00
parent 561fa1e165
commit 37303ea499
No known key found for this signature in database
GPG Key ID: FC23B6D0F1EEE948
2 changed files with 2 additions and 2 deletions

@ -45,7 +45,7 @@ en:
# Number of decimals, behind the separator (the number 1 with a precision of 2 gives: 1.00)
precision: 3
# Determine how rounding is performed (see BigDecimal::mode)
round_mode: !ruby/sym default
round_mode: default
# If set to true, precision will mean the number of significant digits instead
# of the number of decimal digits (1234 with precision 2 becomes 1200, 1.23543 becomes 1.2)
significant: false

@ -13,7 +13,7 @@ def round(number)
precision = absolute_precision(number)
return number unless precision
rounded_number = convert_to_decimal(number).round(precision, options.fetch(:round_mode, :default))
rounded_number = convert_to_decimal(number).round(precision, options.fetch(:round_mode, :default).to_sym)
rounded_number.zero? ? rounded_number.abs : rounded_number # prevent showing negative zeros
end