ruby-i18n / i18n

Internationalization (i18n) library for Ruby
MIT License
977 stars 408 forks source link

Interpolation of numeric values to Arabic translation #605

Closed adi-ronen closed 2 years ago

adi-ronen commented 2 years ago

Hello 😃

I have a translation key that build like that:

key: 'translation_key'
value: 'translation %{value}'

The value is two numbers separated by a dash, for example "1-10"

i18n.t 'translation_key', value: "1-10"

The results: LTR

English: translation 1-10

RTL

Hebrew: 1-10 תרגום
Arabic: 10-1 ترجمة

In Arabic the numbers are flipped.

I tested multiple characters between the two numbers and adding a dot or a comma between numbers does not change their order (thanks god 😜 ).

Greater than (>) is flipping the numbers both in Hebrew and in Arabic.

I expect that RTL languages will have the same behaviour. 1-10 and 10-1 have a different meaning. Is this something you can fix or is there some flag i can use so this interpolation wont flip my numbers?

Versions

i18n - 1.8.9 rails - 6.0.3.6

Thanks! :heart:

radar commented 2 years ago

Greater than (>) is flipping the numbers both in Hebrew and in Arabic.

Where is this greater than?

radar commented 2 years ago

Could you please provide an application that reproduce this issue? That would help me immensely.

adi-ronen commented 2 years ago

@radar here is an application that reproduce this issue. The example is in /app/views/welcome/index.html.erb

radar commented 2 years ago

Thank you @adi-ronen. I think this has to do with how browsers interpret Arabic characters. You are likely running into this issue: https://stackoverflow.com/questions/8227183/rtl-is-on-web-page-reverses-numbers-with-a-dash