Use arabic language with latin numbers

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!
mahmoud
Posts: 27
Joined: 27 Mar 2020, 22:01

Use arabic language with latin numbers

Post by mahmoud » 18 Apr 2021, 14:12

Hello,
windows 10: 64
PostgreSQL 9.6.15
Laravel Framework 8.37.0
PHP 7.4.16
"php": "^7.3|^8.0",
"aimeos/aimeos-laravel": "~2021.04",
by default when I choose the arabic language, aimeos displays the numerals in arabic too, but it is arabic numeral is not used by all arabic countries (٠١ ٢ ٣ ٤ ٥ ٦ ٧ ٨ ٩ ), it uses latin numbers (123 ..).

i want to use arabic language and latin numbers (123 ..)
Image
thank you
Attachments
nombre.png
nombre.png (8.39 KiB) Viewed 1932 times

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

Re: Use arabic language with latin numbers

Post by aimeos » 20 Apr 2021, 10:30

This is automatically done by the browser and the option to use latin number seems to be to change the templates and define

Code: Select all

dir="ltr"
explicitely for all numbers:
https://www.w3.org/International/articl ... di-markup/
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mahmoud
Posts: 27
Joined: 27 Mar 2020, 22:01

Re: Use arabic language with latin numbers

Post by mahmoud » 22 Apr 2021, 02:32

Hi,
I think this

Code: Select all

dir="ltr"
can not solve the problem .

Because when i type:

Code: Select all

 $priceItem->getValue() ;
===> 9999.99
But when i type:

Code: Select all

$this->number( $priceItem->getValue(), $priceItem->getPrecision() ), "$currency" )
===> ٩٩٩٩.٩٩

i want to acces to the function number(. where is ?

thank you

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

Re: Use arabic language with latin numbers

Post by aimeos » 24 Apr 2021, 09:23

The number view helper is available here:
https://github.com/aimeos/aimeos-core/b ... Locale.php

There's also another one available:
https://github.com/aimeos/aimeos-core/b ... andard.php

You can change it overwriting this method:
https://github.com/aimeos/aimeos-larave ... #L161-L170

And then in a Laravel service provider:
https://github.com/aimeos/aimeos-larave ... hp#L92-L94
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mahmoud
Posts: 27
Joined: 27 Mar 2020, 22:01

Re: Use arabic language with latin numbers

Post by mahmoud » 24 Apr 2021, 22:21

Thank you

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

Re: Use arabic language with latin numbers

Post by aimeos » 27 Apr 2021, 06:42

We've simplified that in aimeos/aimeos-laravel:dev-master and added a new config setting for the ./config/shop.php file:

Code: Select all

	'num_formatter' => 'Locale', // locale based number formatter (alternative: "Standard")
If you checkout the master version, you can change the number formatter by adding:

Code: Select all

	'num_formatter' => 'Standard',
Can you check if that works for you?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, Image give us a star

mahmoud
Posts: 27
Joined: 27 Mar 2020, 22:01

Re: Use arabic language with latin numbers

Post by mahmoud » 27 Apr 2021, 22:46

Hi,
I checked this parameter it working perfectly!

Thank you

Post Reply