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

Feature: Added proper support for RTL languages #16514

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from

Conversation

XTorLukas
Copy link
Contributor

@XTorLukas XTorLukas commented Nov 24, 2024

Resolved / Related Issues

To prevent extra work, all changes to the Files codebase must link to an approved issue marked as Ready to build. Please insert the issue number following the hashtag with the issue number that this Pull Request resolves.

Microsoft issues

Steps used to test these changes

Stability is a top priority for Files and all changes are required to go through testing before being merged into the repo. Please include a list of steps that you used to test this PR.

Important

This service function is only used to display the layout correctly.

  1. Opened Files
  2. Set RTL or LTR culture
  3. Automaticaly change flow direction layout

Tests for RTL

  • All Dialogs show correctly
  • All Tooltip show correctly
  • All Windows show correctly
  • All Drag position works correctly
  • Forward & Back swipe in touchscreen works correctly
  • Position dragging works correctly on MainProperties page
  • Tab action button is clickable

@XTorLukas
Copy link
Contributor Author

fyi @0x5bfa

@XTorLukas XTorLukas marked this pull request as ready for review November 26, 2024 13:50
Copy link
Member

@0x5bfa 0x5bfa left a comment

Choose a reason for hiding this comment

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

Looks great. Does this also work for generated content dialogs such as the add new dialog that is shown when Ctrl+Shift+I entered?

src/Files.App/App.xaml.cs Outdated Show resolved Hide resolved
src/Files.App/App.xaml.cs Show resolved Hide resolved
src/Files.App/Data/Contracts/IRealTimeWindow.cs Outdated Show resolved Hide resolved
src/Files.App/Data/Contracts/IRealTimeWindow.cs Outdated Show resolved Hide resolved
src/Files.App/Dialogs/AddBranchDialog.xaml.cs Show resolved Hide resolved
src/Files.App/UserControls/AddressToolbar.xaml Outdated Show resolved Hide resolved
src/Files.App/UserControls/Sidebar/SidebarView.xaml.cs Outdated Show resolved Hide resolved
src/Files.App/ViewModels/Settings/GeneralViewModel.cs Outdated Show resolved Hide resolved
@XTorLukas

This comment was marked as resolved.

@XTorLukas XTorLukas marked this pull request as draft November 29, 2024 22:55
yaira2
yaira2 previously approved these changes Dec 1, 2024
@yaira2 yaira2 changed the title Feature: Adding service function RealTime Layout Service for cultures using RTL/LTR Feature: Added proper support for RTL languages Dec 1, 2024
@yaira2 yaira2 marked this pull request as ready for review December 1, 2024 03:48
@yaira2 yaira2 requested review from 0x5bfa and hishitetsu December 1, 2024 03:48
@marcelwgn
Copy link
Contributor

marcelwgn commented Dec 15, 2024

Thank you for all the effort you put into this PR @XTorLukas. I think it is a good step forward and good you made these investigations, I think there are a few things I would approach differently for this.

The approach with the code generator is quite interesting, however it seems quite complicated to what we would like to achieve here. From what I can see, there are three things we need to do to properly support RTL:

  1. Update the caption buttons to be on the left in RTL
  2. Set the FlowDirection of the MainPage to RTL
  3. Get ContentDialogs to respect our RTL layout

While your approach does achieve this, it also creates a lot of complexity through the interfaces and the code generators associated with them. I would probably prefer a lightweight FlowDirectionService that essentially provides the following API:

  1. A property called FlowDirection that you can bind to (and a function generating bindings for it in code behind)
  2. A method to update the state from LTR to RTL (and vice versa) which sets the correct flags to update the titlebar/caption buttons and sets the FlowDirection property (which updates the bindings)

An open question for me (and something that is also not addressed in this PR right now I think) is how to deal with m

ultiple windows. Does every window have its own FDS? How do all of these get notified of the change?

Edit: Attached is a test version I used for testing RTL stuff FlowDirectionManager.txt

@XTorLukas XTorLukas marked this pull request as draft December 16, 2024 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants