Search code examples
javascriptphphtmllaravellaravel-localization

The numbers get reversed when use of arabic language


I am using laravel localization

Here is the code I am using

<p class="retail-price">@lang('frontend/watch-detail.Reference.retail')
     <span class="prices">
     @if($watch['price'] == 0 || $watch['price'] == NULL) N/A

     @else
         @php
         $text =number_format($watch['price'], 0, ',', ' ');
         @endphp
         {{$text}}
     @endif
     </span>
</p>

Here is what I get in arabic =>Image that I get

While I should get 30 700!

I do not want to use a reverse function


Solution

  • That issue occurs because Arabic is read from right to left. It would be easier to add an if statement to check if it is Arabic, then reverse it, so the reversed Arabic writing is reversed back to non-reversal.