Konash / arabic-support-unity

This plugin allows you to use accurate and correct Arabic text in your game or 3D application. Supports Tashkeel and Hindu numbers. Supports C# and JavaScript. Supports 4 Persian Characters.
MIT License
220 stars 64 forks source link

Order is wrong in mixed-language text #47

Closed Nathipha closed 1 year ago

Nathipha commented 2 years ago

I just downloaded the latest version of the asset for Unity 2021.1 and unfortunately there's a big problem with the order.

Example text (copied from google translate):

This is a test. هذا اختبار. Another test! (it's the wrong order in my actual text, apparently copying it/github changes it!)

Using ArabicFixer.Fix() on it results in this (doesn't matter if it's a 3D TMP text or a regular canvas/UI TMP one):

Another test! .هذا اختبار This is a test.

As you can see, the English text is also swapped and with different test texts it even happens mid-sentence (wherever the Arabic part is).

Any idea how this can be fixed?

Konash commented 2 years ago

In theory, the output is correct because Arabic is a right to left language. As I'm reading this I'm seeing the order as:

  1. This is a test.
  2. .هذا اختبار
  3. Another test!

The input however is not RTL. I hope that clarifies.

On Thu, Feb 3, 2022 at 5:50 PM Nathipha @.***> wrote:

I just downloaded the latest version of the asset for Unity 2021.1 and unfortunately there's a big problem with the order.

Example text (copied from google translate):

This is a test. هذا اختبار. Another test!

Using ArabicFixer.Fix() on it results in this (doesn't matter if it's a 3D text or a TMP text):

Another test! .هذا اختبار This is a test.

As you can see, the English text is also swapped and with different test texts it even happens mid-sentence (wherever the Arabic part is).

Any idea how this can be fixed?

— Reply to this email directly, view it on GitHub https://github.com/Konash/arabic-support-unity/issues/47, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5UCUTEUO2UJR43OYIF3LLUZKI37ANCNFSM5NPEQO5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you are subscribed to this thread.Message ID: @.***>

Nathipha commented 2 years ago

Thanks for your reply! I see, so the asset basically turns everything into Arabic RTL, no matter the actual language used, and doesn't support mixed languages (that would require different directions), correct?

Konash commented 2 years ago

If we consider that, by using the Plugin, Arabic is the default language, then we could say that it does support multiple languages on the same line. But it won't work well if the any other language is the base.

To counter this, you can detect the Arabic part in your sentence, and apply it sentence by sentence rather than word by word.

On Mon, Feb 7, 2022, 12:15 PM Nathipha @.***> wrote:

Thanks for your reply! I see, so the asset basically turns everything into Arabic RTL, no matter the actual language used, and doesn't support mixed languages (that would require different directions), correct?

— Reply to this email directly, view it on GitHub https://github.com/Konash/arabic-support-unity/issues/47#issuecomment-1031236869, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC5UCUUXJTRDDTFBNDLJYGDUZ6EULANCNFSM5NPEQO5A . Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

You are receiving this because you commented.Message ID: @.***>