Add Persian (Farsi) language pack and fix RTL layout direction - #23
Open
codesbygom wants to merge 6 commits into
Open
Add Persian (Farsi) language pack and fix RTL layout direction#23codesbygom wants to merge 6 commits into
codesbygom wants to merge 6 commits into
Conversation
added 6 commits
September 11, 2026 08:44
Full translation of all 441 UI strings in Strings.resx, covering the main window, settings, profile editor, special actions, and the first-launch/welcome wizard.
Windows never adapted their layout direction to the selected culture:
FlowDirection stayed LeftToRight regardless of language, so RTL text
displayed correctly but tab order, alignment, and punctuation
mirroring (parentheses, etc.) stayed LTR and looked broken.
Set FlowDirection only on each window's Content (never the Window
object itself) whenever a window loads, based on whether the current
culture is right-to-left. Setting it on Content instead of Window
keeps native window chrome (title bar button side) and any
images/icons unaffected -- only the actual UI layout flips.
Deliberately not using FlowDirectionProperty.OverrideMetadata on
Window: WPF's own Window static constructor already registers that
exact metadata internally, so a second registration throws
ArgumentException ("PropertyMetadata is already registered...")
the first time any window is constructed.
Both should stay left-to-right regardless of the app's own RTL fix: - The language dropdown lists names in many different scripts (fa, ar, de, ja, ...) at once, including "No (English UI)"; forcing the whole list RTL breaks punctuation on the non-RTL entries. - The controller image in the welcome dialog would otherwise get mirrored along with the rest of the RTL content, which makes the controller diagram look wrong.
NoControllersConnected had two open parentheses and no closing one, a manual compensation for the RTL mirroring bug now fixed by the FlowDirection change. With correct RTL layout in place, the workaround itself renders backwards, so it is reverted to normal, correctly-paired parentheses.
The intro caption and the Markdown changelog viewer both display purely English, dynamically-loaded content (never translated), so mirroring them under RTL misplaces punctuation the same way the language picker and welcome image did before being pinned.
Three spots bypassed the resx localization system entirely and always
showed English regardless of the selected language:
- WelcomeDialog's "Finished" button.
- PresetOptionWindow's title ("Select Preset") and its Yes/No
buttons on the intro tab.
- ControlService's three ViGEmBus status/log messages (not
installed, unsupported version, connection failed).
Added the corresponding resx keys (English default plus Persian
translation) and wired each spot to use them. The ViGEmBus messages
are read from C# via the generated Strings class rather than
{lex:Loc}, so the three new properties were added to
Strings.Designer.cs by hand -- this project's Strings.resx uses a
Visual-Studio-only design-time code generator, so `dotnet build`
from the CLI does not regenerate that file automatically.
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.
Summary
fa) translation covering all 441 strings inStrings.resx.FlowDirectionstayedLeftToRightregardless of the selected culture, so RTL text displayed correctly but tab order, alignment, and punctuation mirroring (parentheses, etc.) stayed LTR-oriented and rendered incorrectly. This affectsfa,ar, andhe.Details
FlowDirectionis now synced to each window's content (never theWindowobject itself) whenever a window loads, based on whether the current culture is right-to-left. This is done via anEventManager.RegisterClassHandlerinApp.xaml.csplus aDynamicResourceinApp.xaml.Windowkeeps native window chrome (title bar button side) and any images/icons unaffected — only the actual UI layout flips.FlowDirectionProperty.OverrideMetadataonWindow: WPF's ownWindowstatic constructor already registers that exact metadata internally, so a second registration throwsArgumentException("PropertyMetadata is already registered...") the first time any window is constructed.LeftToRight, since a multi-script list and a diagram shouldn't mirror along with the rest of the RTL content.Testing
Manually tested on a debug build with
faandarselected: verified tab order, checkbox/label alignment, the language picker, and the welcome wizard all render correctly, and that window chrome (minimize/maximize/close) stays in its normal position.Commits