I'm facing an issue with number formatting in Perspective using the numberFormat transform.
In Brazil (pt-BR), we use the period . as the thousands separator and the comma , as the decimal separator. However, even after properly configuring the locale as pt-BR in:
…the numberFormat({value}, '###,##0.00') still renders the number in US/EN format (e.g., 1,000.00 instead of 1.000,00).
I’m trying to avoid using scripting inside the binding expression due to performance concerns and because I apply this transformation across many views.
What I tried:
I was able to solve it partially by using a Format map transform (type: format, with pattern and locale properties). This approach works for fixed patterns.
However, my formatting pattern is dynamic — it comes from a parameter in my UDTs — and the Format map transform does not allow binding to its pattern or locale properties. This limitation prevents me from dynamically adjusting the format per tag instance.
Question:
Is there a clean and efficient way to:
Use numberFormat or Format transform while respecting the pt-BR locale formatting (without script)?
Bind the pattern dynamically to a tag/parameter when using Format transform?
I think you're going to have to use a script, unfortunately. The numberFormat expression function follows the overall gateway locale; it's not aware of the individual Perspective session locale the way e.g. translate is. That's an oversight on our part that we can fix, but it won't happen for quite a while. Unless changing the gateway itself to pt-BR is an option.
When you mentioned "changing the gateway locale," I assumed you were referring to changing the region settings of the operating system running the Gateway. I’ve already updated the OS locale to pt-BR and restarted the Gateway, but unfortunately the number formatting behavior hasn’t changed — the numberFormat function still uses the default (en-US) separators.
Let me know if there’s another way to set the locale specifically for the Gateway itself, other than through the OS.
Is it possible to configure the locale directly in the Gateway? I checked under Config > System > Gateway Settings, but couldn’t find anything related to locale.