mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
Cherry picked pinyin performance changes from jjw24's master branch
This commit is contained in:
@@ -99,6 +99,22 @@ namespace Wox.Core.Resource
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool PromptShouldUsePinyin(string languageCodeToSet)
|
||||||
|
{
|
||||||
|
var languageToSet = GetLanguageByLanguageCode(languageCodeToSet);
|
||||||
|
|
||||||
|
if (Settings.ShouldUsePinyin)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (languageToSet != AvailableLanguages.Chinese && languageToSet != AvailableLanguages.Chinese_TW)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (MessageBox.Show("Do you want to turn on search with Pinyin?", string.Empty, MessageBoxButton.YesNo) == MessageBoxResult.No)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
private void RemoveOldLanguageFiles()
|
private void RemoveOldLanguageFiles()
|
||||||
{
|
{
|
||||||
var dicts = Application.Current.Resources.MergedDictionaries;
|
var dicts = Application.Current.Resources.MergedDictionaries;
|
||||||
|
|||||||
@@ -162,7 +162,7 @@ namespace Wox.Infrastructure
|
|||||||
|
|
||||||
if (word.Length > 40)
|
if (word.Length > 40)
|
||||||
{
|
{
|
||||||
Log.Debug($"|Wox.Infrastructure.StringMatcher.ScoreForPinyin|skip too long string: {word}");
|
//Skip strings that are too long string for Pinyin conversion.
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ namespace Wox.Infrastructure.UserSettings
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// when false Alphabet static service will always return empty results
|
/// when false Alphabet static service will always return empty results
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ShouldUsePinyin { get; set; } = true;
|
public bool ShouldUsePinyin { get; set; } = false;
|
||||||
|
|
||||||
|
|
||||||
internal StringMatcher.SearchPrecisionScore QuerySearchPrecision { get; private set; } = StringMatcher.SearchPrecisionScore.Regular;
|
internal StringMatcher.SearchPrecisionScore QuerySearchPrecision { get; private set; } = StringMatcher.SearchPrecisionScore.Regular;
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -77,6 +77,33 @@ namespace Wox.ViewModel
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public string Language
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.Language;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
InternationalizationManager.Instance.ChangeLanguage(value);
|
||||||
|
|
||||||
|
if (InternationalizationManager.Instance.PromptShouldUsePinyin(value))
|
||||||
|
ShouldUsePinyin = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool ShouldUsePinyin
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
return Settings.ShouldUsePinyin;
|
||||||
|
}
|
||||||
|
set
|
||||||
|
{
|
||||||
|
Settings.ShouldUsePinyin = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public List<string> QuerySearchPrecisionStrings
|
public List<string> QuerySearchPrecisionStrings
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|||||||
Reference in New Issue
Block a user