Unable to change locale settings

Help for integrating the Laravel package
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
flomo
Posts: 52
Joined: 26 Sep 2019, 15:11

Re: Unable to change locale settings

Post by flomo » 28 Oct 2019, 14:22

Code: Select all

echo (new NumberFormatter('de', NumberFormatter::PATTERN_DECIMAL, ",##0.##"))->format(1234567890.123); // Output: 1.234.567.890,12
echo (new NumberFormatter('de_CH', NumberFormatter::PATTERN_DECIMAL, ",##0.##"))->format(1234567890.123); // Output: 1'234'567'890.12

User avatar
aimeos
Administrator
Posts: 7889
Joined: 01 Jan 1970, 00:00

Re: Unable to change locale settings

Post by aimeos » 28 Oct 2019, 14:24

We've streamlined the behavior in dev-master so you can use "price:default" and "%1$s %2$s" for swapping price value and currency ("price:default" has precedence over "%1$s %2$s"):
https://github.com/aimeos/ai-client-htm ... 2912206a24
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

flomo
Posts: 52
Joined: 26 Sep 2019, 15:11

Re: Unable to change locale settings

Post by flomo » 28 Oct 2019, 17:21

We've streamlined the behavior in dev-master so you can use "price:default" and "%1$s %2$s" for swapping price value and currency ("price:default" has precedence over "%1$s %2$s"):
Excellent, thank you! I can't currently switch to dev-master but will try it out later.

User avatar
aimeos
Administrator
Posts: 7889
Joined: 01 Jan 1970, 00:00

Re: Unable to change locale settings

Post by aimeos » 29 Oct 2019, 08:47

flomo wrote: 28 Oct 2019, 14:22

Code: Select all

echo (new NumberFormatter('de', NumberFormatter::PATTERN_DECIMAL, ",##0.##"))->format(1234567890.123); // Output: 1.234.567.890,12
echo (new NumberFormatter('de_CH', NumberFormatter::PATTERN_DECIMAL, ",##0.##"))->format(1234567890.123); // Output: 1'234'567'890.12
Can you please list again what results you need, e.g. "de_FR" -> "1'234'567'890.12", "de_CH" -> ...?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

flomo
Posts: 52
Joined: 26 Sep 2019, 15:11

Re: Unable to change locale settings

Post by flomo » 29 Oct 2019, 10:44

Can you please list again what results you need, e.g. "de_FR" -> "1'234'567'890.12", "de_CH" -> ...?
I need "1'234'567'890.12", no matter the locale.

But I already have a viable solution for this, by adding my own instance of view to the IOC. No need to spend more of your time for this, I already got more than excellent support for this open source project ;). Thanks again.

Post Reply