Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 12, 2025

This PR implements user-requested functionality to allow switching UI cultures for PowerShell localization data through both VS Code settings and command palette commands.

Features Added

🔧 Configuration Setting

  • Added powershellLocalization.uiCulture setting with default value en-US
  • Includes pattern validation ^[a-z]{2}(-[A-Z]{2})?$ for proper culture format
  • Users can change the setting via VS Code Settings UI or directly in settings.json

🎛️ Command Palette Integration

Three new commands for dynamic culture switching:

  • PowerShell Localization: Switch UI Culture - Interactive input box with validation
  • PowerShell Localization: Set UI Culture to English (en-US) - Quick English switch
  • PowerShell Localization: Set UI Culture to French (fr-FR) - Quick French switch

🔄 Automatic Cache Management

  • Decoration cache automatically clears when UI culture changes
  • Localization values refresh immediately to reflect the new culture
  • Works seamlessly with both setting changes and command palette actions

Technical Implementation

The implementation enhances the existing PowerShell integration by:

  1. Extending the configuration system to handle the new uiCulture setting
  2. Updating PowerShellExecutor to pass the configured culture to the existing LocalizationParser.ps1 script
  3. Adding command handlers in ExtensionManager for interactive culture switching
  4. Maintaining cache coherence when culture settings change

Example usage:

# The extension now calls the PowerShell script with:
pwsh -File LocalizationParser.ps1 -ModuleFile Example.psm1 -UICulture "fr-FR"

# Returns French localized values:
# Key1 = "Valeur1", Key2 = "Valeur2", Key3 = "Valeur3"

Validation

  • ✅ Tested with existing test fixtures (en-US and fr-FR cultures)
  • ✅ PowerShell script integration working correctly
  • ✅ Extension packages successfully
  • ✅ All TypeScript compilation and linting passes

This provides users with flexible options to work with PowerShell modules in different languages, addressing the core need for culture-specific localization display.

Fixes #2.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Switch UICulture's Add UICulture configuration and command palette support for PowerShell localization Aug 12, 2025
Copilot AI requested a review from HeyItsGilbert August 12, 2025 23:51
@HeyItsGilbert HeyItsGilbert marked this pull request as ready for review August 12, 2025 23:57
Co-authored-by: HeyItsGilbert <615265+HeyItsGilbert@users.noreply.github.com>
@HeyItsGilbert HeyItsGilbert merged commit ab82c2b into main Aug 12, 2025
4 checks passed
@HeyItsGilbert HeyItsGilbert deleted the copilot/fix-2 branch August 12, 2025 23:58
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.

Switch UICulture's

2 participants