Add opt-in UI localization framework with Hebrew (RTL) translation#636
Open
yosef-chai wants to merge 1 commit into
Open
Add opt-in UI localization framework with Hebrew (RTL) translation#636yosef-chai wants to merge 1 commit into
yosef-chai wants to merge 1 commit into
Conversation
Adds an optional localization layer so the GUI can be shown in another language. It is fully opt-in: the default language stays English and every localization function is a no-op, so behaviour is unchanged for existing users. How to enable: .\Win11Debloat.ps1 -Language he or set the environment variable WIN11DEBLOAT_LANG=he What it does (only when a language is selected): - New module Scripts/Localization/Localize.ps1 holds a single English -> translation dictionary plus a small runtime engine: Get-LocalizedString, Format-Localized, Invoke-WindowLocalization (walks the loaded WPF tree, translates every visible string and sets FlowDirection to RightToLeft) and Localize-FeaturesData / Localize-ScriptFeatures (translate the display fields of the parsed Features.json / Apps.json data at runtime). - Covers the whole GUI: static XAML, dynamically built strings, message boxes, tooltips, menus, pop-ups, the tweaks/apps lists and all dialogs. Design notes: - Strings that are read back by program logic (e.g. the hidden TabItem header identifiers "App Removal"/"Tweaks") are intentionally not translated. The visible-but-logic-coupled app-removal scope combo now compares on SelectedIndex instead of the displayed text. - Config/ and Schemas/ are left untouched; existing scripts only gained small calls into the localization helpers. - Adds a matching -Language parameter to Win11Debloat.ps1 and Scripts/Get.ps1, and documents it in the README. A new language only needs a second dictionary keyed on the same English source strings.
Owner
|
Heya, Thanks for taking the time to contribute. I haven't been able to fully dive into this yet, but from a quick glance through I did notice that the current implementation is very much focussed on just the 2 translations, making it very hard to expand this in the future. I have been personally experimenting with adding this feature as well in a manner that would make it easier to add multiple languages. With the idea that each language gets a specific language file that is dynamically parsed by the script. You're welcome to continue with this PR and rework it toward that approach. Otherwise I'll pick up where I left off, and you can always add your translations & other changes on top once that's in place. |
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
This PR adds an optional, opt-in UI localization layer so the GUI can be displayed in another language, with Hebrew (עברית) as the first translation including full right-to-left (RTL) layout.
It is completely opt-in. When no language is selected the script behaves exactly as it does today — every localization function short-circuits to a no-op, the layout stays left-to-right and all strings stay in English. There is no behavioural change for existing users.
How to enable
.\Win11Debloat.ps1 -Language heOr, to make it the default without passing the parameter each time, set the
WIN11DEBLOAT_LANGenvironment variable (e.g.he).What it adds
Scripts/Localization/Localize.ps1— a singleEnglish -> translationdictionary plus a small runtime engine:Get-LocalizedString/Format-Localized— used at dynamic call sites.Invoke-WindowLocalization— walks a loaded WPF window, translates every visible string and setsFlowDirectiontoRightToLeft.Localize-FeaturesData/Localize-ScriptFeatures— translate the display fields of the parsedFeatures.json/Apps.jsondata at runtime.-Languageparameter on bothWin11Debloat.ps1andScripts/Get.ps1(kept in sync per the contributing guide), plus a short note in the README.Design & safety notes
TabItemheader identifiersApp Removal/Tweaks) are intentionally not translated, so control flow is unaffected.SelectedIndexinstead of the displayed text.Config/andSchemas/are untouched — no translated text is baked into the data or XAML, which keeps future updates conflict-free.Testing
-Language) produces identical English, left-to-right output.System.Management.Automation.Language.Parserchecks.CONTRIBUTING.mddoes not apply. review and testing feedback is very welcome.