Skip to content

Localize DefaultProvisioningContextProvider interaction strings #10961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 15, 2025

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 14, 2025

This PR addresses the localization of user-facing strings in DefaultProvisioningContextProvider that are displayed through the interaction service. Previously, all strings were hardcoded directly in the code, making them impossible to localize for international users.

Changes Made

Resource Infrastructure:

  • Added Resources/AzureProvisioningStrings.resx with 12 localized strings covering all user-facing text in DefaultProvisioningContextProvider
  • Generated corresponding AzureProvisioningStrings.Designer.cs file following the same pattern as other Aspire projects
  • Build system automatically created .xlf files for 12 languages, enabling future translations

Code Updates:

  • Updated DefaultProvisioningContextProvider to use AzureProvisioningStrings instead of hardcoded strings
  • Added necessary using statement for Aspire.Hosting.Azure.Resources
  • Maintained exact same text values to preserve backward compatibility

Localized Strings Include:

  • Notification titles and messages for Azure provisioning prompts
  • Input labels and placeholders for Location, Subscription ID, and Resource group fields
  • Validation error messages for invalid subscription IDs and resource group names
  • Documentation links and descriptions with markdown support

Testing:

  • Added comprehensive unit tests in AzureProvisioningStringsTests.cs to verify all resource strings load correctly
  • Existing integration tests continue to pass without modification, confirming backward compatibility
  • Build system validates no regressions were introduced

Technical Approach

The implementation follows the established pattern used by other Aspire projects like Aspire.Hosting.Resources.InteractionStrings. Resource strings are accessed directly without dependency injection to match the existing codebase architecture, ensuring consistency across the project.

Example

Before:

var messageBarResult = await interactionService.PromptNotificationAsync(
    "Azure provisioning",
    "The model contains Azure resources that require an Azure Subscription.",
    // ...

After:

var messageBarResult = await interactionService.PromptNotificationAsync(
    AzureProvisioningStrings.NotificationTitle,
    AzureProvisioningStrings.NotificationMessage,
    // ...

This change enables future localization of the Azure provisioning experience while maintaining full backward compatibility with existing functionality.

Fixes #10960.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] Localize using interaction provider with DefaultProvisioningContextProvider Localize DefaultProvisioningContextProvider interaction strings Aug 14, 2025
Copilot finished work on behalf of JamesNK August 14, 2025 06:05
@Copilot Copilot AI requested a review from JamesNK August 14, 2025 06:05
@Copilot Copilot AI requested a review from JamesNK August 14, 2025 06:18
Copilot finished work on behalf of JamesNK August 14, 2025 06:18
@JamesNK JamesNK requested a review from captainsafia August 14, 2025 06:24
@JamesNK JamesNK marked this pull request as ready for review August 14, 2025 06:24
@Copilot Copilot AI review requested due to automatic review settings August 14, 2025 06:24
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR localizes user-facing strings in the Azure provisioning experience by replacing hardcoded strings with resource strings from a new AzureProvisioningStrings.resx file. The change enables future internationalization of Azure provisioning prompts, input labels, and validation messages while maintaining backward compatibility.

  • Adds comprehensive localization infrastructure with 12 resource strings covering all user-facing text
  • Updates DefaultProvisioningContextProvider to use resource strings instead of hardcoded text
  • Generates translation files for 12 languages with proper XLIFF structure

Reviewed Changes

Copilot reviewed 15 out of 16 changed files in this pull request and generated no comments.

File Description
src/Aspire.Hosting.Azure/Resources/AzureProvisioningStrings.resx Adds primary resource file with 12 localized strings for Azure provisioning UI
src/Aspire.Hosting.Azure/Resources/xlf/*.xlf Generated XLIFF translation files for 12 languages with proper structure
src/Aspire.Hosting.Azure/Provisioning/Internal/DefaultProvisioningContextProvider.cs Updates code to use resource strings instead of hardcoded text
Files not reviewed (1)
  • src/Aspire.Hosting.Azure/Resources/AzureProvisioningStrings.Designer.cs: Language not supported

Copy link
Member

@captainsafia captainsafia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as far as the outputs in this for the CLI interaction.

@davidfowl davidfowl enabled auto-merge (squash) August 15, 2025 15:35
@davidfowl davidfowl merged commit 4184c41 into main Aug 15, 2025
1143 of 1150 checks passed
@davidfowl davidfowl deleted the copilot/fix-10960 branch August 15, 2025 15:38
@dotnet-policy-service dotnet-policy-service bot added this to the 9.5 milestone Aug 15, 2025
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.

Localize using interaction provider with DefaultProvisioningContextProvider
4 participants