Skip to content

Add support for creating and updating locales#480

Merged
ryfu-msft merged 11 commits intomicrosoft:mainfrom
mdanish-kh:new-update-locale
Dec 15, 2023
Merged

Add support for creating and updating locales#480
ryfu-msft merged 11 commits intomicrosoft:mainfrom
mdanish-kh:new-update-locale

Conversation

@mdanish-kh
Copy link
Copy Markdown
Contributor

@mdanish-kh mdanish-kh commented Nov 21, 2023

This PR adds two new commands new-locale and update-locale following the specifications listed in issue #78.

Locale comparisons

For locale comparions, I've used RegionInfo Class (reference: https://learn.microsoft.com/en-us/dotnet/api/system.globalization.regioninfo?view=net-7.0&redirectedfrom=MSDN). The benefit here is that it validates the locale format and also treats locales such as en-US, en-USA, en-us etc as same which prevents duplicate locales added in the manifest.

### Command flow shift

For now, I've only added supporting for shifting from new-locale to update-locale and vice-versa when --locale argument is provided. My thinking here is that since both the commands support creating/updating multiple locales, what if the user enters a non-existing locale after updating multiple locales? User may expect the generated PR to contain both updated and newly created locales, but I've not handled that case here.

Let me know if I should add the ability to prompt for flow change whenever an invalid locale is input by the user (or only the first time user inputs an invalid locale?). Removed (see #480 (comment))


Microsoft Reviewers: Open in CodeFlow

@mdanish-kh mdanish-kh requested review from a team, ryfu-msft and yao-msft and removed request for a team November 21, 2023 07:04
@microsoft-github-policy-service microsoft-github-policy-service Bot added the Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. label Nov 21, 2023
Comment thread src/WingetCreateCLI/PromptHelper.cs
Copy link
Copy Markdown
Contributor

@ryfu-msft ryfu-msft left a comment

Choose a reason for hiding this comment

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

Apologies for the delay 😅 This is a really cool feature so it took me some time to get through all of it since we don't have very good tests for prompting.

Comment thread doc/new-locale.md Outdated
Comment thread src/WingetCreateCLI/Commands/NewLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/NewLocaleCommand.cs
Comment thread src/WingetCreateCLI/Commands/NewLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/LocaleHelper.cs Outdated
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs Outdated
Copy link
Copy Markdown
Contributor Author

@mdanish-kh mdanish-kh left a comment

Choose a reason for hiding this comment

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

I've resolved many of the review comments but left the ones out that require having #480 (comment) resolved first and ones requiring additional feedback

Comment thread src/WingetCreateCLI/Commands/BaseCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/NewLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/NewLocaleCommand.cs
Comment thread src/WingetCreateCLI/Commands/NewLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs
Comment thread src/WingetCreateCLI/LocaleHelper.cs Outdated
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs Outdated
@mdanish-kh mdanish-kh requested a review from ryfu-msft December 11, 2023 15:20
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/NewLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/NewLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs Outdated
Comment thread src/WingetCreateCLI/Commands/UpdateLocaleCommand.cs Outdated
@mdanish-kh mdanish-kh requested a review from ryfu-msft December 14, 2023 19:11
@ryfu-msft
Copy link
Copy Markdown
Contributor

/azp run

@azure-pipelines
Copy link
Copy Markdown

Azure Pipelines successfully started running 1 pipeline(s).

Copy link
Copy Markdown
Contributor

@ryfu-msft ryfu-msft left a comment

Choose a reason for hiding this comment

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

Super awesome, thanks for working on this!

@ryfu-msft ryfu-msft merged commit 445ffa2 into microsoft:main Dec 15, 2023
@mdanish-kh mdanish-kh deleted the new-update-locale branch December 15, 2023 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Simplify localization for existing packages

2 participants