Repository navigation
Conversation
WPF mirrors text direction and TextAlignment, but no layout: HorizontalAlignment is absolute, Grid keeps its column order and StackPanel/WrapPanel/DockPanel keep their child order and Dock values. The optimization card template hardcoded all three, so in ar-SA, he-IL and fa-IR the tag row hugged the left edge, the tag icon sat on the wrong side of its label, and the footer kept badges left with the toggle and buttons right. Adds two one-way converters in Common/Converters and binds them to Loc.Instance.Direction: ReadingStartAlignmentConverter / ReadingEndAlignmentAlignmentConverter for the edge, ReadingStartColumnConverter / ReadingEndColumnConverter for swapping the two footer groups. OptimizationPage.xaml is the worked example. The tag chip swaps its icon and label through Grid.Column instead of a horizontal StackPanel, and the icon gap became a symmetric Margin because Grid has no ColumnSpacing in WPF. Verified by replicating the card footer and chip with the real converters and measuring the arranged coordinates: LTR is unchanged (badges x=0, actions x=320 of 400, icon left of the label), RTL mirrors (badges x=250, actions x=0, icon x=372 right of the label). Also documents the rule in CONTRIBUTING.md and AGENTS.md, and corrects the locale count that went stale when fa-IR merged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the right-to-left layout of the optimization cards, reported against Persian but affecting every RTL locale (
ar-SA,he-IL,fa-IR).Cause
WPF mirrors text direction and
TextAlignment, and nothing else. Measured on this TFM:FlowDirection="RightToLeft"TextAlignmentHorizontalAlignment="Left"Gridcolumn orderStackPanel/WrapPanelhorizontal child orderDockPanel.Dock="Left"OptimizationPage.xamlhardcoded all of those, so in RTL:The three-dot details dialog was unaffected, which matches the report: it is single column and text only.
Fix
Two one-way converters in
Common/Converters/, bound toLoc.Instance.Directionand registered inUI/Styles/Converters.xaml:ReadingStartAlignmentConverter/ReadingEndAlignmentConverter(FlowDirectionToHorizontalAlignmentConverter,ToEndEdge) pick the reading start or the far edgeReadingStartColumnConverter/ReadingEndColumnConverter(FlowDirectionToColumnConverter,Invert) swap the two footer groupsThe tag chip swaps its icon and label through
Grid.Columninstead of a horizontalStackPanel, and the icon gap became a symmetricMarginbecause WPF'sGridhas noColumnSpacing. That adds 6px to the chip's leading padding in both directions; the icon-to-label gap is unchanged at 6px.Verification
Replicated the card footer and the chip with the real converters and measured the arranged coordinates of a 400px card:
LTR is byte-for-byte the old layout, RTL is its mirror.
dotnet build optimizerDuck.slnx --configuration Release: 0 warnings, 0 errors-longRunning 30:Total: 768, Errors: 0, Failed: 0, Skipped: 5csharpier check .: clean (306 files)Docs
CONTRIBUTING.mdgains a "Right-to-Left Languages" section with the mirrored/not-mirrored table and the binding pattern,AGENTS.mdgets the one line rule, and the locale count in both (plus the two translatedCONTRIBUTINGcopies' reference in the English file) is corrected from 17 to 18, which went stale when fa-IR merged.Not in this PR
Only the optimization card template is touched, which is where the report pointed and where the asymmetry is visible. The other pages keep hardcoded edges in their toolbars and detail rows and would need the same treatment; that is a separate pass.
The navigation pane already mirrors itself, which is why the sidebar looked right while the content did not.