Skip to content
Merged
Show file tree
Hide file tree
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
9 changes: 3 additions & 6 deletions Flow.Launcher.Core/Resource/Internationalization.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,13 +96,10 @@ public void ChangeLanguage(Language language)
{
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;
Expand Down Expand Up @@ -193,7 +190,7 @@ private void UpdatePluginMetadataTranslations()
{
p.Metadata.Name = pluginI18N.GetTranslatedPluginTitle();
p.Metadata.Description = pluginI18N.GetTranslatedPluginDescription();
pluginI18N.OnCultureInfoChanged(CultureInfo.DefaultThreadCurrentCulture);
pluginI18N.OnCultureInfoChanged(CultureInfo.CurrentCulture);
}
catch (Exception e)
{
Expand Down
2 changes: 1 addition & 1 deletion Flow.Launcher/Converters/QuerySuggestionBoxConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ values[2] is not string queryText ||
// 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;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -136,9 +134,9 @@ public string DateFormat
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
{
Expand Down
5 changes: 2 additions & 3 deletions Flow.Launcher/ViewModel/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,6 @@ public void CopyAlternative()
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()
{
Expand All @@ -494,9 +493,9 @@ private async Task RegisterClockAndDateUpdateAsync()
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);
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.ComponentModel;
using Flow.Launcher.Core.Resource;

namespace Flow.Launcher.Plugin.Caculator
namespace Flow.Launcher.Plugin.Calculator
{
[TypeConverter(typeof(LocalizationConverter))]
public enum DecimalSeparator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
<TargetFramework>net7.0-windows</TargetFramework>
<ProjectGuid>{59BD9891-3837-438A-958D-ADC7F91F6F7E}</ProjectGuid>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Flow.Launcher.Plugin.Caculator</RootNamespace>
<AssemblyName>Flow.Launcher.Plugin.Caculator</AssemblyName>
<RootNamespace>Flow.Launcher.Plugin.Calculator</RootNamespace>
<AssemblyName>Flow.Launcher.Plugin.Calculator</AssemblyName>
<UseWPF>true</UseWPF>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
Expand All @@ -18,7 +18,7 @@
<DebugSymbols>true</DebugSymbols>
<DebugType>portable</DebugType>
<Optimize>false</Optimize>
<OutputPath>..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.Caculator\</OutputPath>
<OutputPath>..\..\Output\Debug\Plugins\Flow.Launcher.Plugin.Calculator\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand All @@ -28,7 +28,7 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>..\..\Output\Release\Plugins\Flow.Launcher.Plugin.Caculator\</OutputPath>
<OutputPath>..\..\Output\Release\Plugins\Flow.Launcher.Plugin.Calculator\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
Expand Down
10 changes: 5 additions & 5 deletions Plugins/Flow.Launcher.Plugin.Calculator/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
using System.Windows;
using System.Windows.Controls;
using Mages.Core;
using Flow.Launcher.Plugin.Caculator.ViewModels;
using Flow.Launcher.Plugin.Caculator.Views;
using Flow.Launcher.Plugin.Calculator.ViewModels;
using Flow.Launcher.Plugin.Calculator.Views;

namespace Flow.Launcher.Plugin.Caculator
namespace Flow.Launcher.Plugin.Calculator
{
public class Main : IPlugin, IPluginI18n, ISettingProvider
{
Expand Down Expand Up @@ -62,7 +62,7 @@ public List<Result> Query(Query query)
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:
Expand Down Expand Up @@ -158,7 +158,7 @@ private string ChangeDecimalSeparator(decimal value, string newDecimalSeparator)

private string GetDecimalSeparator()
{
string systemDecimalSeperator = CultureInfo.DefaultThreadCurrentCulture.NumberFormat.NumberDecimalSeparator;
string systemDecimalSeperator = CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator;
switch (_settings.DecimalSeparator)
{
case DecimalSeparator.UseSystemLocale: return systemDecimalSeperator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
using System.Text;
using System.Text.RegularExpressions;

namespace Flow.Launcher.Plugin.Caculator
namespace Flow.Launcher.Plugin.Calculator
{
/// <summary>
/// Tries to convert all numbers in a text from one culture format to another.
Expand Down
2 changes: 1 addition & 1 deletion Plugins/Flow.Launcher.Plugin.Calculator/Settings.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

namespace Flow.Launcher.Plugin.Caculator
namespace Flow.Launcher.Plugin.Calculator
{
public class Settings
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using System.Collections.Generic;
using System.Linq;

namespace Flow.Launcher.Plugin.Caculator.ViewModels
namespace Flow.Launcher.Plugin.Calculator.ViewModels
{
public class SettingsViewModel : BaseModel
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<UserControl
x:Class="Flow.Launcher.Plugin.Caculator.Views.CalculatorSettings"
x:Class="Flow.Launcher.Plugin.Calculator.Views.CalculatorSettings"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:calculator="clr-namespace:Flow.Launcher.Plugin.Caculator"
xmlns:calculator="clr-namespace:Flow.Launcher.Plugin.Calculator"
xmlns:core="clr-namespace:Flow.Launcher.Core.Resource;assembly=Flow.Launcher.Core"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="clr-namespace:Flow.Launcher.Infrastructure.UI;assembly=Flow.Launcher.Infrastructure"
xmlns:viewModels="clr-namespace:Flow.Launcher.Plugin.Caculator.ViewModels"
xmlns:viewModels="clr-namespace:Flow.Launcher.Plugin.Calculator.ViewModels"
d:DesignHeight="450"
d:DesignWidth="800"
Loaded="CalculatorSettings_Loaded"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
using System.Windows;
using System.Windows.Controls;
using Flow.Launcher.Plugin.Caculator.ViewModels;
using Flow.Launcher.Plugin.Calculator.ViewModels;

namespace Flow.Launcher.Plugin.Caculator.Views
namespace Flow.Launcher.Plugin.Calculator.Views
{
/// <summary>
/// Interaction logic for CalculatorSettings.xaml
Expand Down
4 changes: 2 additions & 2 deletions Plugins/Flow.Launcher.Plugin.Calculator/plugin.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
"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",
"ExecuteFileName": "Flow.Launcher.Plugin.Calculator.dll",
"IcoPath": "Images\\calculator.png"
}