Skip to content
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

Fix OpenUtau failed to search singers when the user runs OpenUtau for the first time #1155

Merged
merged 3 commits into from
Jun 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions OpenUtau.Core/Util/LocalizedSort.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,17 @@ public int Compare(string x, string y) {
public static class LocalizedSort {
public static IEnumerable<T> LocalizedOrderBy<T>(this IEnumerable<T> source, Func<T, string> selector) {
var sortingOrder = Preferences.Default.SortingOrder;
if(sortingOrder == String.Empty) {
sortingOrder = Preferences.Default.Language;
CultureInfo culture;
if(sortingOrder == null) {
//Follow the display language
culture = CultureInfo.GetCultureInfo(Preferences.Default.Language);
} else if(sortingOrder == String.Empty){
//Don't translate
culture = CultureInfo.InvariantCulture;
} else {
culture = CultureInfo.GetCultureInfo(sortingOrder);
}
var comparer = new LocalizedComparer(CultureInfo.GetCultureInfo(sortingOrder));
var comparer = new LocalizedComparer(culture);
return source.OrderBy(selector, comparer);
}
}
Expand Down
Loading