NO BUG: Displaying discount percentage issue on RTL websites

Browser: Chrome 141.0.7390.123
OS: Windows

Hi bricks team.

On RTL websites, the discount percentage is displayed as 7%-. While it should be %7-.

As a request, it would be great if we had full control over the percentage output display. For example {woo_product_on_sale:value} which only returns integers. Then we can put - or % in the appropriate position. On the other hand it would help to be able to display the discount percentage without - because that also makes sense. For example 7%.

Hi @HOSEIN,

thank you so much. I was able to replicate it and I’ve recorded it in our internal bug tracker.

Thanks,
Matej

1 Like

Hi @HOSEIN,

I understand why this might be confusing, but this isn’t an issue with Bricks. Instead, it’s due to the way browsers handle text direction for European numbers, following the Unicode Bidirectional Algorithm. If you create a new HTML page with RTL direction and type “-10%”, you’ll see the same result.

Numbers (and the percent sign % or ٪) are treated as left-to-right runs, even inside right-to-left text. That’s why -10٪ ends up shown as 10٪- in Farsi pages, the browser is following the Unicode rules, not a Bricks setting or styling.


See: Arabic & Persian Layout Requirements

If you really want to adjust this manually, you can use the Arabic Letter Mark (U+061C) as a workaround. You may copy it from this site: ؜ - arabic letter mark (u+061C) copy and paste - Unicode® symbol.

This is an invisible character that tells the browser “the following text belongs to Arabic context”.

When placed right before your dynamic percentage tag, it forces the sign to display in the visually correct RTL order.

We can’t automatically add this in Bricks because not all RTL languages need or expect it , for example:

  • In Hebrew, the percent sign needs to be shown on the right of the number (7%).
  • In Arabic, it’s traditionally on the left (ŮŞ7-), but when using European digits the web standards allow it on either side, which is why browsers render it on the right by default.

So this isn’t a Bricks bug, just a result of how text direction works on the web (even though I also find it odd).

1 Like

Hi @charaf,

Thank you for taking the time to review this and also for the great explanation. Yes, you are right and I think that is why all Persian apps and websites display the discount amount as %7.

Is there a way to return the output of the discount amount as an integer? For example 7. Then we can have control over its output in any form (in different languages).

Something like: {woo_product_on_sale:value}

Nope, I don’t think that’s currently possible using the built-in dynamic data. Maybe you can figure something out using an echo: function :slight_smile: Dynamic Data – Bricks Academy

1 Like