Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using only symbols are not RTL when running the project with internationalization/locale/test=ar #81348

Closed
dhoverml opened this issue Sep 5, 2023 · 3 comments · Fixed by #81361
Assignees
Milestone

Comments

@dhoverml
Copy link

dhoverml commented Sep 5, 2023

Godot version

v4.2.dev4.official [549fcce]

System information

Ubuntu 20.04 LTS

Issue description

See title.

Steps to reproduce

  1. Create a new project
  2. Create a csv file that includes the following
key,ar
key,placeholder
  1. Add the generated .translation file to Project -> Project Settings... -> Localization
  2. In Project -> Project Settings... -> Internationalization -> Locale, set Test to ar
  3. Add a LineEdit node and type -=[]{}
  4. Run the project, and notice that the text is on the right side, but the symbols are incorrectly in LTR (-=[]{}). Correct output is {}[]=-
  5. Back in the editor, add a single Arabic letter (any will do), and notice that LineEdit immediately (and correctly) flips the symbols, and the newly-added Arabic letter, to RTL.

Notes

  • Identical behavior is seen with TextEdit.
  • The purpose of steps 2-4 are to simulate an Arabic environment when the project is run, despite OS.get_locale() == "en" (or your system's current language).

Minimal reproduction project

rtlsymbols.zip

@akien-mga
Copy link
Member

CC @bruvzg

@bruvzg bruvzg self-assigned this Sep 5, 2023
@bruvzg
Copy link
Member

bruvzg commented Sep 6, 2023

It's not a bug, by default text direction is determined only based on the text itself, if you want it to be based on locale/layout direction you can switch text direction from "Auto" to "Inherited". But detection for neutral text probably can be improved.

Screenshot 2023-09-06 at 08 33 58

@dhoverml
Copy link
Author

dhoverml commented Sep 6, 2023

Thanks @bruvzg ! I tested your fix and it resolves this bug.

However I see two possible, unrelated, minor bugs with both your fix and 4.1.1-stable:

First:

  • (good) setting Text Direction to Inherited for LineEdit works.
  • (bad) setting Text Direction to Inherited for TextEdit also works, however I see Invalid text direction when I set the setting in the editor, and a bunch of these when I run the project:
    text_edit_text_direction_inherited

Second:
The text and cursor slightly shifts left and right as I type any character. I am able to repro with:

  1. Create a new project
  2. Add a LineEdit node
  3. Set Layout Direction to Right-to-Left
  4. Run the project
  5. (bad) Type ababab, one at a time, and notice the cursor shifts slightly to the left and right as you type a then b. It's subtle.
  6. (good) Back in the editor, set Font size to 50. Relaunch the app, and notice typing ababab doesn't shift the cursor as you type each letter.

Let me know if you'd like separate issues written for one or both of these.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants