[go: up one dir, main page]

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

Farsi/Persian Layout #206

Merged
merged 22 commits into from
Aug 2, 2024
Merged

Farsi/Persian Layout #206

merged 22 commits into from
Aug 2, 2024

Conversation

Tirbod
Copy link
Contributor
@Tirbod Tirbod commented Jul 21, 2024

I Added Farsi/Persian layout based on MessageEase and Thumb-Key(Far better layout for Farsi) layouts and made Farsi numeric and numeric mini layouts but I have no idea how to add them properly, I tried to add them to NumericLayerOption but since only 1 numeric keyboard can be used at a time, it can't be used beside English numeric layout and I'm not sure how to merge separate layouts with separate symbols layout.

there can be some improvements:
I didn't change shifted symbols.
I commented TextDirection workaround for RTL languages because Samsung devices flip these characters automatically regardless of keyboard and ruin this workaround.
I used visualOverride in order to display some characters better but I have no idea about forceRawKeyEvent variable.

@Tirbod Tirbod changed the title Farsi Layout Farsi/Persian Layout Jul 21, 2024
@nightkr
Copy link
Owner
nightkr commented Jul 21, 2024

Interesting.. I guess that means we'll have to allow layouts to override the numeric layers, which isn't really something supported currently.

forceRawKeyEvent generally shouldn't be necessary here, it's for things like tab that apps often want to intercept and handle themselves.

@nightkr
Copy link
Owner
nightkr commented Jul 21, 2024

Have a look at 0ca7824, it should let you do the numbers by setting Layout(digits = ...).

@nightkr
Copy link
Owner
nightkr commented Jul 21, 2024

I commented TextDirection workaround for RTL languages because Samsung devices flip these characters automatically regardless of keyboard and ruin this workaround.

Is this still an issue on 0.1.6? It changed the RTL rendering to hopefully be slightly less wonky.

@Tirbod
Copy link
Contributor Author
Tirbod commented Jul 21, 2024

Have a look at 0ca7824, it should let you do the numbers by setting Layout(digits = ...).

It worked great, Thanks a lot. I updated main layouts accordingly.
can same be done with symbols? I can pass Farsi symbols layout to mergedFullSizedNumericLayer but it would change other layouts too.

@nightkr
Copy link
Owner
nightkr commented Jul 21, 2024

Generally, language-specific symbols (where they absolutely have to exist) are done by just adding them to the regular letters layout.

@Tirbod
Copy link
Contributor Author
Tirbod commented Jul 21, 2024

Is this still an issue on 0.1.6? It changed the RTL rendering to hopefully be slightly less wonky.

it's not an issue with keyboard. brackets should be flipped to be displayed correctly in other devices, but Samsung devices flip them automatically regardless of keyboard so they shouldn't be flipped in order to be displayed correctly in Samsung devices.

@nightkr
Copy link
Owner
nightkr commented Jul 21, 2024

Any idea how they decide to do this? Based on the system language?

@Tirbod
Copy link
Contributor Author
Tirbod commented Jul 21, 2024

Generally, language-specific symbols (where they absolutely have to exist) are done by just adding them to the regular letters layout.

Farsi and similar RTL languages like Arabic use RTL symbols for some characters(unlike Hebrew) like question mark(؟), comma(،) and semicolon(؛) and we use diacritical marks which are necessary sometimes but would clutter letters layout.

@Tirbod
Copy link
Contributor Author
Tirbod commented Jul 21, 2024

Any idea how they decide to do this? Based on the system language?

I added different layout for Samsung devices in thumb-key and same can be done here. I'm not familiar with android programming but is it possible to add some toggle switch in settings that overrides flipBrackets function behavior? like by default flipBrackets work accordingly but some control variable controlled by toggle switch could change its behavior.

@Tirbod
Copy link
Contributor Author
Tirbod commented Jul 22, 2024

and it's not related to system language (using English myself), it behaves like this when it encounters RTL characters.

other devices:
typing ) beside RTL characters flips it and it would look like ( but it's actually not changed (same character but looks like it has flipped).
Samsung devices:
typing ) beside RTL characters would actually replace it with ( and would look like ). (in order to show them correctly I assume)

most popular keyboards map brackets and similar characters to opposing direction characters in RTL layouts in order to display them correctly but since Samsung flip them again it would ruin this workaround.

@AhmadMoradDoctor
Copy link

Hi I am new here , This is my first time . I want to make pull request , I don't know how , This site i svery complicated lol. I would like to share in creating Arabic lazout. What should I do ? I have zero experience in Programming.

@nightkr
Copy link
Owner
nightkr commented Jul 24, 2024

@AhmadMoradDoctor Let's make a separate issue for this, since it's a separate layout (as far as I'm aware). I've filed #210. But in short, the process is:

  1. Look at https://github.com/nightkr/flickboard/blob/main/app/src/main/java/se/nullable/flickboard/model/layouts/ENMessagEase.kt
  2. Modify it with the characters you want
  3. Send the modified file to me, either by creating a pull request here or by emailing it to me (nat@nullable.se)

Optionally, if you have Android Studio (https://developer.android.com/studio) then it should show you live previews for your layout as you edit it. Otherwise any plain text editor (such as Notepad) should work.

@nightkr
Copy link
Owner
nightkr commented Jul 30, 2024

Okay, added a generic workaround for RTL bracketing in d4c357c.

@nightkr
Copy link
Owner
nightkr commented Aug 1, 2024

Are the paragraph symbols intentional?

@Tirbod
Copy link
Contributor Author
Tirbod commented Aug 1, 2024

Okay, added a generic workaround for RTL bracketing in d4c357c.

just tried it and its working great, thanks.

@Tirbod
Copy link
Contributor Author
Tirbod commented Aug 1, 2024

Are the paragraph symbols intentional?

yeah, I'm trying to display RLM character visually and I thought maybe ¶‹ is better than and its resemble Microsoft word RTL icon. what's your thought?

@nightkr
Copy link
Owner
nightkr commented Aug 1, 2024

I don't use RTL myself so I have no idea what's comfortable or expected for RTL users.

@Tirbod
Copy link
Contributor Author
Tirbod commented Aug 2, 2024

with symbols layouts, it's ready for merge thanks.

there are just 2 visual problems:
1.
image
image
turning "don't reverse brackets option" off make label for RLM characters looks like ݦ.

1.farsi/arabic diacritics aren't displaying correctly in layout(font related maybe?)

@Tirbod Tirbod marked this pull request as ready for review August 2, 2024 01:06
@nightkr
Copy link
Owner
nightkr commented Aug 2, 2024

Hm, might be.. :/

@nightkr
Copy link
Owner
nightkr commented Aug 2, 2024

1.farsi/arabic diacritics aren't displaying correctly in layout(font related maybe?)

Not sure what you mean here :/ maybe we can open a separate issue for that?

@nightkr nightkr merged commit 58d9368 into nightkr:main Aug 2, 2024
@Tirbod
Copy link
Contributor Author
Tirbod commented Aug 2, 2024

1.farsi/arabic diacritics aren't displaying correctly in layout(font related maybe?)

Not sure what you mean here :/ maybe we can open a separate issue for that?

they should be displayed like this in layout:
image
how they are displayed:
image

visualOverride = ActionVisual.Label("¶‹"),
visualOverride = ActionVisual.Label(
"¶‹",
directionOverride = TextDirection.RightToLeft
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it should be TextDirection.LeftToRight to be displayed as ¶‹

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@nightkr
Copy link
Owner
nightkr commented Aug 3, 2024

they should be displayed like this in layout:

The core issue seems to be that they get rendered outside of the Text's bounding box, and thus get clipped away if the BoxWithConstraints gets its own rendering layer. The "fix" is to add a space to add back the required padding.

4de289d

@Tirbod Tirbod deleted the Farsi branch August 3, 2024 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants