You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey everyone,
I found the Number::currency() helper suprisingly frustrating to use in some cases. After looking into the code for two minutes, I realised, that this function pretty much is a nice wrapper for this PHP function: https://www.php.net/manual/en/numberformatter.formatcurrency.php#120956.
The problems I see that arise from relying on this function can be summed up pretty much by this comment where the author is wondering on why some currency symbols are available for certain locales but not for others: https://www.php.net/manual/en/numberformatter.formatcurrency.php#120956
Apart from inconstencies like the one above, some currency symbols are not used at all.
My suggestion would be to rewrite the Number::currency method so that it gets rid of the inconsistencies between locales and so that it also supports more currency symbols.
My assumption is that a lot of fonts don't have support for very rarely used Unicode Code Points, but I see no reason to not also add optional support for them.
Maybe an additional optional flag to fall back to the currently underlying PHP function would help to mitigate this potential problem. This would also be a way to provide backwards-compatibility somewhat.
What do you think about my proposal? It would be a task that I would be willing to implement myself as well.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hey everyone,
I found the Number::currency() helper suprisingly frustrating to use in some cases. After looking into the code for two minutes, I realised, that this function pretty much is a nice wrapper for this PHP function: https://www.php.net/manual/en/numberformatter.formatcurrency.php#120956.
The problems I see that arise from relying on this function can be summed up pretty much by this comment where the author is wondering on why some currency symbols are available for certain locales but not for others: https://www.php.net/manual/en/numberformatter.formatcurrency.php#120956
Apart from inconstencies like the one above, some currency symbols are not used at all.
My suggestion would be to rewrite the Number::currency method so that it gets rid of the inconsistencies between locales and so that it also supports more currency symbols.
My assumption is that a lot of fonts don't have support for very rarely used Unicode Code Points, but I see no reason to not also add optional support for them.
Maybe an additional optional flag to fall back to the currently underlying PHP function would help to mitigate this potential problem. This would also be a way to provide backwards-compatibility somewhat.
What do you think about my proposal? It would be a task that I would be willing to implement myself as well.
Best regards from Germany,
Michael
Beta Was this translation helpful? Give feedback.
All reactions