mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Fix calculator decimal separator bug
This commit is contained in:
parent
3436c57f93
commit
fa2df93dd7
6 changed files with 11 additions and 17 deletions
|
|
@ -96,13 +96,10 @@ namespace Flow.Launcher.Core.Resource
|
|||
{
|
||||
LoadLanguage(language);
|
||||
}
|
||||
// Culture of this thread
|
||||
// Use CreateSpecificCulture to preserve possible user-override settings in Windows
|
||||
// Culture of main thread
|
||||
// Use CreateSpecificCulture to preserve possible user-override settings in Windows, if Flow's language culture is the same as Windows's
|
||||
CultureInfo.CurrentCulture = CultureInfo.CreateSpecificCulture(language.LanguageCode);
|
||||
CultureInfo.CurrentUICulture = CultureInfo.CurrentCulture;
|
||||
// App domain
|
||||
CultureInfo.DefaultThreadCurrentCulture = CultureInfo.CreateSpecificCulture(language.LanguageCode);
|
||||
CultureInfo.DefaultThreadCurrentUICulture = CultureInfo.DefaultThreadCurrentCulture;
|
||||
|
||||
// Raise event after culture is set
|
||||
Settings.Language = language.LanguageCode;
|
||||
|
|
@ -193,7 +190,7 @@ namespace Flow.Launcher.Core.Resource
|
|||
{
|
||||
p.Metadata.Name = pluginI18N.GetTranslatedPluginTitle();
|
||||
p.Metadata.Description = pluginI18N.GetTranslatedPluginDescription();
|
||||
pluginI18N.OnCultureInfoChanged(CultureInfo.DefaultThreadCurrentCulture);
|
||||
pluginI18N.OnCultureInfoChanged(CultureInfo.CurrentCulture);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class QuerySuggestionBoxConverter : IMultiValueConverter
|
|||
// Check if Text will be larger than our QueryTextBox
|
||||
Typeface typeface = new Typeface(queryTextBox.FontFamily, queryTextBox.FontStyle, queryTextBox.FontWeight, queryTextBox.FontStretch);
|
||||
// TODO: Obsolete warning?
|
||||
var ft = new FormattedText(queryTextBox.Text, CultureInfo.DefaultThreadCurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, queryTextBox.FontSize, Brushes.Black);
|
||||
var ft = new FormattedText(queryTextBox.Text, CultureInfo.CurrentCulture, System.Windows.FlowDirection.LeftToRight, typeface, queryTextBox.FontSize, Brushes.Black);
|
||||
|
||||
var offset = queryTextBox.Padding.Right;
|
||||
|
||||
|
|
|
|||
|
|
@ -21,8 +21,6 @@ namespace Flow.Launcher.SettingPages.ViewModels;
|
|||
|
||||
public partial class SettingsPaneThemeViewModel : BaseModel
|
||||
{
|
||||
private CultureInfo Culture => CultureInfo.DefaultThreadCurrentCulture;
|
||||
|
||||
public Settings Settings { get; }
|
||||
|
||||
public static string LinkHowToCreateTheme => @"https://flowlauncher.com/docs/#/how-to-create-a-theme";
|
||||
|
|
@ -136,9 +134,9 @@ public partial class SettingsPaneThemeViewModel : BaseModel
|
|||
set => Settings.DateFormat = value;
|
||||
}
|
||||
|
||||
public string ClockText => DateTime.Now.ToString(TimeFormat, Culture);
|
||||
public string ClockText => DateTime.Now.ToString(TimeFormat, CultureInfo.CurrentCulture);
|
||||
|
||||
public string DateText => DateTime.Now.ToString(DateFormat, Culture);
|
||||
public string DateText => DateTime.Now.ToString(DateFormat, CultureInfo.CurrentCulture);
|
||||
|
||||
public double WindowWidthSize
|
||||
{
|
||||
|
|
|
|||
|
|
@ -485,7 +485,6 @@ namespace Flow.Launcher.ViewModel
|
|||
public Settings Settings { get; }
|
||||
public string ClockText { get; private set; }
|
||||
public string DateText { get; private set; }
|
||||
public CultureInfo Culture => CultureInfo.DefaultThreadCurrentCulture;
|
||||
|
||||
private async Task RegisterClockAndDateUpdateAsync()
|
||||
{
|
||||
|
|
@ -494,9 +493,9 @@ namespace Flow.Launcher.ViewModel
|
|||
while (await timer.WaitForNextTickAsync().ConfigureAwait(false))
|
||||
{
|
||||
if (Settings.UseClock)
|
||||
ClockText = DateTime.Now.ToString(Settings.TimeFormat, Culture);
|
||||
ClockText = DateTime.Now.ToString(Settings.TimeFormat, CultureInfo.CurrentCulture);
|
||||
if (Settings.UseDate)
|
||||
DateText = DateTime.Now.ToString(Settings.DateFormat, Culture);
|
||||
DateText = DateTime.Now.ToString(Settings.DateFormat, CultureInfo.CurrentCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ namespace Flow.Launcher.Plugin.Caculator
|
|||
switch (_settings.DecimalSeparator)
|
||||
{
|
||||
case DecimalSeparator.Comma:
|
||||
case DecimalSeparator.UseSystemLocale when CultureInfo.DefaultThreadCurrentCulture.NumberFormat.NumberDecimalSeparator == ",":
|
||||
case DecimalSeparator.UseSystemLocale when CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator == ",":
|
||||
expression = query.Search.Replace(",", ".");
|
||||
break;
|
||||
default:
|
||||
|
|
@ -158,7 +158,7 @@ namespace Flow.Launcher.Plugin.Caculator
|
|||
|
||||
private string GetDecimalSeparator()
|
||||
{
|
||||
string systemDecimalSeperator = CultureInfo.DefaultThreadCurrentCulture.NumberFormat.NumberDecimalSeparator;
|
||||
string systemDecimalSeperator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
|
||||
switch (_settings.DecimalSeparator)
|
||||
{
|
||||
case DecimalSeparator.UseSystemLocale: return systemDecimalSeperator;
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
"Name": "Calculator",
|
||||
"Description": "Provide mathematical calculations.(Try 5*3-2 in Flow Launcher)",
|
||||
"Author": "cxfksword",
|
||||
"Version": "3.1.0",
|
||||
"Version": "3.1.1",
|
||||
"Language": "csharp",
|
||||
"Website": "https://github.com/Flow-Launcher/Flow.Launcher",
|
||||
"ExecuteFileName": "Flow.Launcher.Plugin.Caculator.dll",
|
||||
|
|
|
|||
Loading…
Reference in a new issue