atorch / probability_puzzles

Android App
GNU General Public License v3.0
36 stars 5 forks source link

Always use left-to-right for user input #21

Closed rillig closed 1 year ago

rillig commented 2 years ago

The input consists only of mathematical symbols, not of natural language text.

Previously, using the app in a right-to-left language, such as Hebrew or Arabic, started the input on the right-hand side of the input field, and typing a '(' was shown as ')'.

Mentioned in https://github.com/atorch/probability_puzzles/issues/20.

rillig commented 2 years ago

@Roymaor01 I am assuming that in Hebrew, mathematical expressions are written from left to right, just like in English. Is that assumption correct?

I tried this left-to-right input field in the Android emulator, using a Hebrew on-screen keyboard. There, I typed 6+(5) using the on-screen keyboard: image That's an unpleasant user experience because the parentheses on the on-screen Hebrew keyboard are intended to be used with Hebrew text, so what looks like ) is actually an opening parenthesis and ( is the closing parenthesis.

Android does not offer a predefined input field for mathematical expressions. Such an input field might then choose a more appropriate keyboard layout. In the past, I already wondered whether this app should provide its own keyboard layout, since even on the German keyboard, typing an expression is cumbersome for the user. I always have to switch to numeric mode, and when I want to type 0.49^8, I have to switch to another keyboard layout for the ^.

Adding a custom keyboard layout is quite a lot of work, I think, as we would have to think about different screen sizes, light and dark themes and probably some more graphic design questions.

@Roymaor01 Do you have an idea how you would want the input field to look like in Hebrew? Do you know of any other Android app that has already solved this problem?

Roymaor01 commented 2 years ago

All mathematical expressions are written from left to right, even in Hebrew. I think that the input line orientation always should be from left to right as an app setting overriding local language direction. In my app, the input is written from right to left: in complex expressions, though sometimes it looks a mass and bsckwards, i type the right answer. Dont worry about the brackets (). I dont think you should add an app keyboard. I think you should add a setting/language page, and maybe a reset option. Have you checked up crownin website? I used it from translation another app.

rillig commented 2 years ago

In my app, the input is written from right to left

I know. In this pull request, I am suggesting to change the input field to always be left-to-right.

Dont worry about the brackets ().

Could you explain this in a bit more detail? I'm deeply worried about the parentheses ( and ) right now, because on the screenshot above, when you tap on ( on the keyboard, it shows as ) in the input field.

Should I not worry about this because Hebrew users are generally aware of this problem and will easily notice this mismatch between what they see and what they get? Still, I find this situation uncomfortable.

I dont think you should add an app keyboard.

Why not? It would not only be useful for Hebrew and other right-to-left languages, but also for English and German users, see my detailed description in https://github.com/atorch/probability_puzzles/issues/23.

I think you should add a setting/language page, and maybe a reset option.

What would be on that setting/language page? And what would the "reset option" do?

Have you checked up crownin website? I used it from translation another app.

That's an entirely different topic. A better place to discuss this is https://github.com/atorch/probability_puzzles/issues/20.

Roymaor01 commented 2 years ago

As you mentioned, in Hebrew we are aware of the math syntax while typing from right to left. Usually I type without stopping to think about it. Now I check slowly what i type: I use the right brackets ')' before the left brackets '(' so that the phrase is shown correctly. I wrote against adding a mathematical keyboard to the app, as a personal intuition, preferring to use Android builtin user keyboard rather than a specific predefined one. I thought it is too much of an effort in this stage. One useful shortcut we have in our PC (using Windows etc.) is of swiching the input direction from r2l to l2r and bsckwards by clicking Ctrl+Shift. I suggested to add a screen in which one can choose and change the app language, without losing his progress of the game, of his correct answers. I suggested to add a reset button, so one can delete his progress of the game, of his correct answers. These improvements can be suggested as independent Issues.