Skip to content

Add Persian (Farsi) language pack and fix RTL layout direction - #23

Open
codesbygom wants to merge 6 commits into
ds4windowsapp:mainfrom
codesbygom:feature/persian-language-and-rtl-fix
Open

Add Persian (Farsi) language pack and fix RTL layout direction#23
codesbygom wants to merge 6 commits into
ds4windowsapp:mainfrom
codesbygom:feature/persian-language-and-rtl-fix

Conversation

@codesbygom

Copy link
Copy Markdown

Summary

  • Adds a full Persian (fa) translation covering all 441 strings in Strings.resx.
  • Fixes a pre-existing bug where the app's layout never adapted to RTL languages: FlowDirection stayed LeftToRight regardless 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 affects fa, ar, and he.
  • Fixes a hardcoded parenthesis workaround already present in the Arabic translation that was compensating for the same bug.

Details

  • FlowDirection is now synced to each window's content (never the Window object itself) whenever a window loads, based on whether the current culture is right-to-left. This is done via an EventManager.RegisterClassHandler in App.xaml.cs plus a DynamicResource in App.xaml.
  • Setting it on the content instead of the 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.
  • The language picker dropdown and the welcome-dialog controller image are explicitly pinned to 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 fa and ar selected: 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

  1. Add Persian (fa) language pack
  2. Fix layout direction for RTL languages (fa, ar, he)
  3. Pin language picker and welcome image to LTR
  4. Fix hardcoded parenthesis workaround in Arabic translation

arash 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.
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.

1 participant