microsoft / winget-create

The Windows Package Manager Manifest Creator command-line tool (aka wingetcreate)
MIT License
498 stars 85 forks source link

Add support for creating and updating locales #480

Closed mdanish-kh closed 9 months ago

mdanish-kh commented 10 months ago

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 https://github.com/microsoft/winget-create/pull/480#discussion_r1418146150)


Microsoft Reviewers: Open in CodeFlow
ryfu-msft commented 9 months ago

/azp run

azure-pipelines[bot] commented 9 months ago
Azure Pipelines successfully started running 1 pipeline(s).