Why do I get different format on percentage depending on the language I use?

Hi,
In Sweden we us comma as separator. For example 1,25% instead of 1.25%. But in Silverfin we use 1.25 to make calculations.

We have this variable {% assign stateloan_interest_code17a = 0.0125 | percentage %}
When using English as language in our module, we get 1.25% and we can make all sorts of calculations with this variable, but when changing to Swedish as language, we get 1,25% and all calculations are made with only the number 1.
We have checked the code, and we have no variables set up with comma. Any idea how to solve this?

image

Kind regards,
Anna

Hi @ahaegglund,

I think the issue could be in this assignment, where you are applying the filter percentage inside the assign tag. Since you have already defined you value as 0.0125 there is no need to apply the percentage filter there. You can use directly that variable in your calculations.
Then, in the row you are going to display the percentage, you apply the filter. This kind of filters are mainly intended to be used while “printing” values (since they give an specific formatting, that in some cases could make that it is no longer consider as number type)

Consider this example for your case:

{% assign total_basis = 9333459 %}
{% assign stateloan_interest_code17a = 0.0125 %}


Total basis: {{ total_basis | integer }}
Percentage: {{ stateloan_interest_code17a | percentage }}
Calculated tax: {{ total_basis*stateloan_interest_code17a | integer }}

I hope this helps and solves you issue!

Thank you, yes it seems to work when I removed the “| percentage” from assign. I just thought it was strange that it worked in the English view.