Modify

Opened 6 years ago

Closed 3 years ago

Last modified 3 years ago

#16163 closed enhancement (fixed)

Right To Left support for input boxes

Reported by: iman Owned by: iman
Priority: normal Milestone: 21.10
Component: Core Version:
Keywords: RTL bidirectional arabic Cc: aat765

Description

Currently the text we type in input boxes is Left-to-Right and left aligned by default. When writing in a RTL language like Persian, Arabic, etc it's better we have a RTL environment to type in.

For example on input boxes of this website we can switch between RTL and LTR text direction by pressing "right ctrl + shift" or "left ctrl + shift".

Such an ability is so useful for users who their language is RTL.

Attachments (6)

1.gif (17.1 KB ) - added by iman 5 years ago.
sample.osm (285 bytes ) - added by iman 5 years ago.
rtl_ltr_display.png (16.7 KB ) - added by iman 5 years ago.
2.png (19.3 KB ) - added by iman 5 years ago.
Screenshot 2021-04-09 at 21.21.56.png (127.6 KB ) - added by simon04 3 years ago.
jp2launcher_RkVU9Ouoml.png (8.8 KB ) - added by aat765 3 years ago.
arabic RTL

Download all attachments as: .zip

Change History (30)

comment:1 by iman, 6 years ago

Owner: changed from team to iman
Type: defectenhancement

by iman, 5 years ago

Attachment: 1.gif added

by iman, 5 years ago

Attachment: sample.osm added

by iman, 5 years ago

Attachment: rtl_ltr_display.png added

by iman, 5 years ago

Attachment: 2.png added

comment:2 by iman, 5 years ago

There's also another option: auto-switching direction and alignment based on first character of a word (Strong Left or Right character based on Unicode standards).

For example:
If I start typing "name", since it starts with "n", so the inputbox remains LTR and left-aligned.
Now I want to type a Persian name into the "value" inputbox, e.g. "خیابان سوم". Since this value starts with the RTL letter "خ" inputbox should be RTL and right-aligned.

Why this is important?
This reduces user confusion and prevent values such as "5 کوچه" (="5 Alley") instead of "کوچه 5" (="Alley 5"), because user see he is typing "Alley 5" but on display he gets "5 Alley". There are more examples that some of them are even more complex that really can confuse users. Also maybe it reduce the usage of some invisible characters such as "right-to-left embeding" that forces the following string to be displayed RTL.

This gif shows what user gets while typing in a RTL script:

https://josm.openstreetmap.de/attachment/ticket/16163/1.gif

In the following screenshots you can see that the inputbox shows the string from left to right, while with the tags pane all is fine and it shows them correctly (similar to display on the map).

https://josm.openstreetmap.de/attachment/ticket/16163/2.png

https://josm.openstreetmap.de/attachment/ticket/16163/rtl_ltr_display.png

In case of RTL script, it's better to have right-alignment too, for the inputboxes. Because with left-alignment for a rtl string users get confused about start of the string: do it starts from the starting point of the inputbox, or from right side of the first letter? where he should click? You know, not all people are aware about Home/End keys.

Version 0, edited 5 years ago by iman (next)

comment:3 by Sosha, 5 years ago

really 14 months ago and anyone don't respond to this issue?

literally this bug very very on my nerve. please someone resolv this issue.

comment:4 by simon04, 3 years ago

In 17730/josm:

see #16163 - MainApplication: apply component orientation based on locale

comment:5 by simon04, 3 years ago

In 17731/josm:

see #16163 - ExtendedDialog.setupDialog: apply component orientation from MainFrame

comment:6 by simon04, 3 years ago

In 17732/josm:

see #16163 - Prefer GridBagConstraints.LINE_START over GridBagConstraints.WEST

comment:7 by simon04, 3 years ago

In 17733/josm:

see #16163 - Prefer SwingConstants.LEADING over SwingConstants.LEFT

comment:8 by simon04, 3 years ago

In 17734/josm:

see #16163 - Fix SwingConstants.LEFT for PreferenceTabbedPane

comment:9 by Don-vip, 3 years ago

Milestone: 21.04

comment:10 by simon04, 3 years ago

In 17738/josm:

see #16163 - Fix NPE in unit tests

comment:11 by simon04, 3 years ago

Cc: aat765 added
Keywords: arabic added
Milestone: 21.0421.05

@iman, aat765, please report if things improved and whether this is the right way to go...

by aat765, 3 years ago

Attachment: jp2launcher_RkVU9Ouoml.png added

arabic RTL

in reply to:  11 comment:12 by aat765, 3 years ago

Replying to simon04:

@iman, aat765, please report if things improved and whether this is the right way to go...

https://josm.openstreetmap.de/attachment/ticket/16163/jp2launcher_RkVU9Ouoml.png

Thank you, yes it is working properly now for Arabic language.

comment:13 by hubaishan, 3 years ago

All tag keys are Latin script (LTR) so "key" text box must be (LTR) Left Aligned even if interface language is (RTL).

All tag values are Latin script (LTR) exept names and addresses in (RTL) languages (Arabic, Persian ...). So the best behavior is "value" textbox must be (LTR) Left Aligned even if interface language is (RTL) exept 2 cases value box must be right Aligned and (RTL):

  1. When the tag key is name in (RTL) language like (name:ar, name:fa, alt_name:ar...) even if interface language is (LTR).
  2. When interface language is (RTL) and tag is unlocaliesd name (name,alt_name) or address (addr:*).
Last edited 3 years ago by hubaishan (previous) (diff)

comment:14 by iman, 3 years ago

This way the problem still exists but in another form: User wants to type an English string, while text box is forced RTL.

I prefer a mechanism to switch direction of text inside input box based on user demand regardless of interface language.

For instance this is Notepad.exe on Windows with a button to switch text direction:

https://s18.picofile.com/file/8432913184/switch_reading_order_in_notepad_exe.gif

(Also with hotkey for rtl direction: right ctrl + shift and hotkey for ltr direction: left ctrl + shift)

Last edited 3 years ago by iman (previous) (diff)

comment:15 by simon04, 3 years ago

Milestone: 21.0521.06

comment:16 by hubaishan, 3 years ago

I am agree with Iman.
I see changing text direction by hot keys also seen in some Open-source Java programs like
http://docfetcher.sourceforge.net/en/index.html
The search textbox uses this feature

comment:17 by Don-vip, 3 years ago

Milestone: 21.0621.07

comment:18 by Don-vip, 3 years ago

Milestone: 21.0721.08

comment:19 by Don-vip, 3 years ago

Milestone: 21.08Longterm

comment:20 by Don-vip, 3 years ago

Milestone: Longterm21.09

should be fixed with #21319

comment:21 by Don-vip, 3 years ago

Resolution: fixed
Status: newclosed

In 18221/josm:

fix #21319 - Refactoring of class hierarchy around JosmComboBox / AutoCompComboBox (patch by marcello):

  • Code reuse: JosmComboBox now uses a JosmTextField as editor
  • Code reuse: AutoCompComboBox now uses AutoCompTextField as editor
  • JosmComboBox uses more of the original L&F
  • JosmComboBox lists now expand all the way to the bottom or the top of the screen
  • Variable height items in combobox lists now work, see #19321
  • Autocomplete uses different algorithm, fix #21290
  • editable="false" comboboxes in Presets now work, fix #6157 see #11024 see #18714
  • The user may toggle LTR-RTL script in JosmTextField (menu and ctrl+space)
  • LTR-RTL automatically toggles according to key in AddTag and EditTag dialogs, fix #16163

comment:22 by iman, 3 years ago

Tested with latest build. Very nice! Thank you.
Auto toggle based on key is also awesome!

Last edited 3 years ago by iman (previous) (diff)

comment:23 by hubaishan, 3 years ago

Wonderful! Thank you very much.

comment:24 by Don-vip, 3 years ago

Milestone: 21.0921.10

Milestone renamed

Modify Ticket

Change Properties
Set your email in Preferences
Action
as closed The owner will remain iman.
as The resolution will be set.
The resolution will be deleted. Next status will be 'reopened'.

Add Comment


E-mail address and name can be saved in the Preferences .
 
Note: See TracTickets for help on using tickets.