Closed mysliwietzflorian closed 10 months ago
Isn't this already possible using https://pimcore.com/docs/platform/Pimcore/Multi_Language_i18n/Formatting_Service?
@NiklasBr
Isn't this already possible using https://pimcore.com/docs/platform/Pimcore/Multi_Language_i18n/Formatting_Service?
Maybe I have overlooked something. As far as I have tried you can set a pattern for a locale, but you cannot have different patterns depending on the value. In my example above I use the default Swiss format, but change the pattern if a specific value occurs ('#,##0.–'
).
I could not figure out a way to do this. ;)
There is a patthern
argument you can use though.
There is a
patthern
argument you can use though.
Agree. I see your point. That means I'd need to check before the call of formatCurrency
. Should work for me. ;)
Proposal: Add an event before any currency is formatted to add flexibility for the formatting patterns. Code could still be improved (Add custom event model, define event name), but do we want this change?
Our use-case is a new Swiss tenant, where two different common currency formats exist:
CHF 10.50
for values with Rappen value != 0 OR110.–
for values with Rappen value == 0The change in this PR allows us to write something like inside an EventSubscriber: