-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Multiple locale support for winget workflows #903
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
Conversation
Misspellings found, please review:
To accept these changes, run the following commands from this repository on this branch
|
Misspellings found, please review:
To accept these changes, run the following commands from this repository on this branch
|
doc/Settings.md
Outdated
|
||
The `locale` behavior affects the choice of installer based on installer locale. The matching parameter is `--locale`, and uses bcp47 language tag. | ||
|
||
Note the locale preference will also be applied to `winget show` command if applicable. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should they? It feels like a separate setting should exist for display language. #Closed
{ | ||
if (!Utility::IsWellFormedBcp47Tag(execArgs.GetArg(Args::Type::Locale))) | ||
{ | ||
throw CommandException(Resource::String::InvalidArgumentValueError, s_ArgumentName_Locale, { "bcp47 language tags"_lis }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
{ | ||
if (!Utility::IsWellFormedBcp47Tag(execArgs.GetArg(Args::Type::Locale))) | ||
{ | ||
throw CommandException(Resource::String::InvalidArgumentValueError, s_ArgumentName_Locale, { "bcp47 language tags"_lis }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<data name="LanguageArgumentDescription" xml:space="preserve"> | ||
<value>Language to install (if supported)</value> | ||
<data name="LocaleArgumentDescription" xml:space="preserve"> | ||
<value>Locale to install (if supported)</value> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!preferredList.empty()) | ||
{ | ||
// TODO: we only take the first one for now | ||
preference = preferredList.at(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This suggests that the setting should also be an array. What are the complications with taking the whole list? The only one that comes to mind is that the sort is harder, but I don't think that is insurmountable. #Closed
#include <string> | ||
#include <vector> | ||
|
||
namespace AppInstaller::Utility |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!preferredList.empty()) | ||
{ | ||
// TODO: we only take the first one for now | ||
targetLocale = preferredList.at(0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@@ -15,42 +15,42 @@ namespace AppInstaller::Repository::Microsoft | |||
struct ARPHelper | |||
{ | |||
// See https://docs.microsoft.com/en-us/windows/win32/msi/uninstall-registry-key for details. | |||
std::wstring SubKeyPath{ L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall" }; | |||
inline static const std::wstring SubKeyPath{ L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall" }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
double firstScore = first.Locale.empty() ? Locale::UnknownLanguageDistanceScore : Locale::GetDistanceOfLanguage(preferredLocale, first.Locale); | ||
double secondScore = second.Locale.empty() ? Locale::UnknownLanguageDistanceScore : Locale::GetDistanceOfLanguage(preferredLocale, second.Locale); | ||
|
||
if (firstScore > secondScore && firstScore >= Locale::MinimumDistanceScoreAsCompatibleMatch) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (firstScore > secondScore && firstScore >= Locale::MinimumDistanceScoreAsCompatibleMatch)
The search through m_preference needs to stop whenever either score is compatible. So:
if (firstScore >= Compat || secondScore => Compat)
return firstScore > secondScore;
This is required or you could have IsFirstBetter return true for both orderings of first and second. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change
This change implements support for multi locale in winget workflows.
Validation
Microsoft Reviewers: Open in CodeFlow