Compare commits

...

28 Commits

Author SHA1 Message Date
Stefan Markovic
a6bc3b5307 adkowkadoTEST 2023-08-13 11:22:41 +02:00
Stefan Markovic
d20debbb13 FIX 2023-08-12 13:33:48 +02:00
Stefan Markovic
e0e42a0224 singing 2023-08-11 20:27:34 +02:00
Stefan Markovic
94cfccb747 STSTS 2023-08-11 19:02:48 +02:00
Stefan Markovic
d4e59b5ca1 Fix2 2023-08-11 18:59:03 +02:00
Stefan Markovic
b360497ba9 PPP 2023-08-11 17:08:39 +02:00
Stefan Markovic
4f5273f76a ASDADASD 2023-08-11 14:57:23 +02:00
Stefan Markovic
26b25ce3b4 TTTT 2023-08-11 14:33:46 +02:00
Stefan Markovic
851302041d aaaA 2023-08-11 13:24:17 +02:00
Stefan Markovic
187bf580c7 T 2023-08-11 12:22:56 +02:00
Stefan Markovic
f517a10533 TEST @ @ @ 2023-08-11 11:46:13 +02:00
Stefan Markovic
c29f49ed0f test 2023-08-11 11:02:09 +02:00
Stefan Markovic
8ddcc523a6 Revert "Fix build 2"
This reverts commit 1cd63ae6ce.
2023-08-11 11:01:57 +02:00
Stefan Markovic
1cd63ae6ce Fix build 2 2023-08-11 10:20:14 +02:00
Stefan Markovic
1ea8280436 Fix build 2023-08-10 19:53:54 +02:00
Stefan Markovic
321c8a6f54 Remove de-DE 2023-08-10 19:03:29 +02:00
Stefan Markovic
4db87edfc4 Merge remote-tracking branch 'origin/main' into stefan/lang 2023-08-10 19:02:59 +02:00
Stefan Markovic
a280f3dd90 WIP2 2023-08-10 18:40:34 +02:00
Stefan Markovic
2c798c168e WIP Settings 2023-08-10 14:51:54 +02:00
Stefan Markovic
d844c4d142 Merge remote-tracking branch 'origin/main' into stefan/lang 2023-08-09 10:23:26 +02:00
Stefan Markovic
d150230597 Merge remote-tracking branch 'origin/main' into stefan/lang 2023-08-08 15:21:31 +02:00
Stefan Markovic
4afa8a8958 Fix PT Run 2023-08-08 10:10:21 +02:00
Stefan Markovic
0e6e02f147 PT Run 2023-08-07 18:02:09 +02:00
Stefan Markovic
de76797885 FZ and try/catch others 2023-08-07 17:17:07 +02:00
Stefan Markovic
b517d9bb79 ImageResizer 2023-08-07 12:30:36 +02:00
Stefan Markovic
9e53c99cbb ColorPicker 2023-08-07 11:36:20 +02:00
Stefan Markovic
f34108bd43 Language setting 2023-08-07 11:36:15 +02:00
Stefan Markovic
ed797076b8 TEST 2023-08-05 20:33:16 +02:00
129 changed files with 1038 additions and 330 deletions

View File

@@ -266,6 +266,7 @@
"Vanara.PInvoke.User32.dll",
"WinUI3Apps\\clrcompression.dll",
"WinUI3Apps\\Microsoft.Graphics.Canvas.Interop.dll",
"WinUI3Apps\\WinUI3Localizer.dll",
"Microsoft.Web.WebView2.Core.dll",
"Microsoft.Web.WebView2.WinForms.dll",
"Microsoft.Web.WebView2.Wpf.dll",

View File

@@ -65,6 +65,7 @@
<PackageVersion Include="UnitsNet" Version="4.145.0" />
<PackageVersion Include="Vanara.PInvoke.User32" Version="3.4.11" />
<PackageVersion Include="Vanara.PInvoke.Shell32" Version="3.4.11" />
<PackageVersion Include="WinUI3Localizer" Version="1.0.1" />
<PackageVersion Include="WinUIEx" Version="2.2.0" />
<PackageVersion Include="WPF-UI" Version="3.0.0-preview.4" />
</ItemGroup>

View File

@@ -92,6 +92,7 @@
<RemoveFolder Id="RemoveBaseApplicationsAssetsFolder" Directory="BaseApplicationsAssetsFolder" On="uninstall"/>
<RemoveFolder Id="RemoveWinUI3AppsInstallFolder" Directory="WinUI3AppsInstallFolder" On="uninstall"/>
<RemoveFolder Id="RemoveWinUI3AppsAssetsFolder" Directory="WinUI3AppsAssetsFolder" On="uninstall"/>
<RemoveFolder Id="RemoveWinUI3AppsStringsFolder" Directory="WinUI3AppsStringsFolder" On="uninstall"/>
<RemoveFolder Id="RemoveINSTALLFOLDER" Directory="INSTALLFOLDER" On="uninstall"/>
</Component>
<ComponentRef Id="powertoys_exe" />

View File

@@ -367,8 +367,8 @@
<Directory Id="WinUI3AppsMicrosoftUIXamlInstallFolder" Name="Microsoft.UI.Xaml">
<Directory Id="WinUI3AppsMicrosoftUIXamlAssetsInstallFolder" Name="Assets" />
</Directory>
<Directory Id="WinUI3AppsAssetsFolder" Name="Assets">
</Directory>
<Directory Id="WinUI3AppsAssetsFolder" Name="Assets"/>
<Directory Id="WinUI3AppsStringsFolder" Name="Strings"/>
</Directory>
<Directory Id="ToolsFolder" Name="Tools"/>
</Directory>

View File

@@ -6,6 +6,7 @@
<?define SettingsV2AssetsFiles=?>
<?define SettingsV2AssetsFilesPath=$(var.BinDir)WinUI3Apps\Assets\Settings\?>
<?define SettingsV2StringsFilesPath=$(var.BinDir)WinUI3Apps\Strings\Settings\?>
<?define SettingsV2AssetsModulesFiles=?>
<?define SettingsV2AssetsModulesFilesPath=$(var.BinDir)WinUI3Apps\Assets\Settings\Modules\?>
@@ -16,6 +17,12 @@
<?define SettingsV2OOBEAssetsFluentIconsFiles=?>
<?define SettingsV2OOBEAssetsFluentIconsFilesPath=$(var.BinDir)WinUI3Apps\Assets\Settings\FluentIcons\?>
<?ifdef env.IsPipeline?>
<?define LocLanguageList = cs-CZ;de-DE;en-US;es-ES;fr-FR;hu-HU;it-IT;ja-JP;ko-KR;nl-NL;pl-PL;pt-BR;pt-PT;ru-RU;sv-SE;tr-TR;zh-CN;zh-TW?>
<?else?>
<?define LocLanguageList = en-US?>
<?endif?>
<Fragment>
<DirectoryRef Id="WinUI3AppsAssetsFolder">
<Directory Id="SettingsV2AssetsInstallFolder" Name="Settings">
@@ -25,6 +32,86 @@
</Directory>
</Directory>
</DirectoryRef>
<DirectoryRef Id="WinUI3AppsStringsFolder">
<Directory Id="SettingsStringsFolder" Name="Settings" />
</DirectoryRef>
<?foreach Language in $(var.LocLanguageList)?>
<!--NB: Ids can't contain hyphens-->
<?if $(var.Language) = cs-CZ?>
<?define IdSafeLanguage = cs_CZ?>
<?define CompGUID = 715E1991-43CC-4D32-98C8-5BBC9B649FD5?>
<?elseif $(var.Language) = de-DE?>
<?define IdSafeLanguage = de_DE?>
<?define CompGUID = 60EF66F9-7721-4EDB-A0DF-F64F5F2F402A?>
<?elseif $(var.Language) = en-US?>
<?define IdSafeLanguage = en_US?>
<?define CompGUID = 3CEF6FD7-348D-40EC-A75F-6351597CC091?>
<?elseif $(var.Language) = es-ES?>
<?define IdSafeLanguage = es_ES?>
<?define CompGUID = E0A3DD93-18DB-4BAA-A343-E33BFA8FB789?>
<?elseif $(var.Language) = fr-FR?>
<?define IdSafeLanguage = fr_FR?>
<?define CompGUID = A09AC847-F3F1-4C1C-A47D-F60B5218B73D?>
<?elseif $(var.Language) = hu-HU?>
<?define IdSafeLanguage = hu_HU?>
<?define CompGUID = B47DF99E-80FE-4F18-80FD-98085BED74D6?>
<?elseif $(var.Language) = it-IT?>
<?define IdSafeLanguage = it_IT?>
<?define CompGUID = 87DE1759-9749-4205-86D3-EE3F21740E8B?>
<?elseif $(var.Language) = ja-JP?>
<?define IdSafeLanguage = ja_JP?>
<?define CompGUID = DACD7B23-A12C-4469-B35A-F95CD6DD2121?>
<?elseif $(var.Language) = ko-KR?>
<?define IdSafeLanguage = ko_KR?>
<?define CompGUID = 40BBFD14-BF0A-49C6-80A0-8EC564F1CB65?>
<?elseif $(var.Language) = nl-NL?>
<?define IdSafeLanguage = nl_NL?>
<?define CompGUID = 6A6BBAF7-8CFB-458C-A20D-2484B4FB9B5A?>
<?elseif $(var.Language) = pl-PL?>
<?define IdSafeLanguage = pl_PL?>
<?define CompGUID = E03CDC2E-3D8A-4B14-BC70-C66B8C46A2EB?>
<?elseif $(var.Language) = pt-BR?>
<?define IdSafeLanguage = pt_BR?>
<?define CompGUID = FFAA45E5-6933-412A-B0A8-97F59E635419?>
<?elseif $(var.Language) = pt-PT?>
<?define IdSafeLanguage = pt_PT?>
<?define CompGUID = 7ECECEE4-095A-437E-AEDC-95FE77C3065E?>
<?elseif $(var.Language) = ru-RU?>
<?define IdSafeLanguage = ru_RU?>
<?define CompGUID = 30752E37-34DF-4359-B317-AE043015C204?>
<?elseif $(var.Language) = sv-SE?>
<?define IdSafeLanguage = sv_SE?>
<?define CompGUID = 61FF96C4-DADC-4CF2-91FA-60DCAF70DE21?>
<?elseif $(var.Language) = tr-TR?>
<?define IdSafeLanguage = tr_TR?>
<?define CompGUID = 821A28CF-DB00-4CD9-AFCF-B14B00014528?>
<?elseif $(var.Language) = zh-CN?>
<?define IdSafeLanguage = zh_CN?>
<?define CompGUID = 79586358-7BDA-46D4-94A6-99DB8F269630?>
<?elseif $(var.Language) = zh-TW?>
<?define IdSafeLanguage = zh_TW?>
<?define CompGUID = E4686F9A-F347-44B3-9244-BB8A9BE92193?>
<?else?>
<?define IdSafeLanguage = $(var.Language)?>
<?define CompGUID = 19C2DCCC-7A75-47D4-9957-2480D388CA5C?>
<?endif?>
<DirectoryRef Id="SettingsStringsFolder">
<Directory Id="Strings$(var.IdSafeLanguage)Settings" Name="$(var.Language)" />
</DirectoryRef>
<DirectoryRef Id="Strings$(var.IdSafeLanguage)Settings" FileSource="$(var.SettingsV2StringsFilesPath)\$(var.Language)">
<Component Id="Strings$(var.IdSafeLanguage)SettingsComp" Win64="yes" Guid="$(var.CompGUID)">
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
<RegistryValue Type="string" Name="Strings$(var.IdSafeLanguage)SettingsComp" Value="" KeyPath="yes"/>
</RegistryKey>
<File Id="Strings$(var.IdSafeLanguage)SettingsResourceFile" Source="$(var.SettingsV2StringsFilesPath)\$(var.Language)\Resources.resw" />
</Component>
</DirectoryRef>
<?undef IdSafeLanguage?>
<?undef CompGUID?>
<?endforeach?>
<DirectoryRef Id="SettingsV2AssetsInstallFolder" FileSource="$(var.SettingsV2AssetsFilesPath)">
<!-- Generated by generateFileComponents.ps1 -->
<!--SettingsV2AssetsFiles_Component_Def-->
@@ -47,6 +134,51 @@
<ComponentGroup Id="SettingsComponentGroup">
<?foreach Language in $(var.LocLanguageList)?>
<!--NB: Ids can't contain hyphens-->
<?if $(var.Language) = cs-CZ?>
<?define IdSafeLanguage = cs_CZ?>
<?elseif $(var.Language) = de-DE?>
<?define IdSafeLanguage = de_DE?>
<?elseif $(var.Language) = en-US?>
<?define IdSafeLanguage = en_US?>
<?elseif $(var.Language) = es-ES?>
<?define IdSafeLanguage = es_ES?>
<?elseif $(var.Language) = fr-FR?>
<?define IdSafeLanguage = fr_FR?>
<?elseif $(var.Language) = hu-HU?>
<?define IdSafeLanguage = hu_HU?>
<?elseif $(var.Language) = it-IT?>
<?define IdSafeLanguage = it_IT?>
<?elseif $(var.Language) = ja-JP?>
<?define IdSafeLanguage = ja_JP?>
<?elseif $(var.Language) = ko-KR?>
<?define IdSafeLanguage = ko_KR?>
<?elseif $(var.Language) = nl-NL?>
<?define IdSafeLanguage = nl_NL?>
<?elseif $(var.Language) = pl-PL?>
<?define IdSafeLanguage = pl_PL?>
<?elseif $(var.Language) = pt-BR?>
<?define IdSafeLanguage = pt_BR?>
<?elseif $(var.Language) = pt-PT?>
<?define IdSafeLanguage = pt_PT?>
<?elseif $(var.Language) = ru-RU?>
<?define IdSafeLanguage = ru_RU?>
<?elseif $(var.Language) = sv-SE?>
<?define IdSafeLanguage = sv_SE?>
<?elseif $(var.Language) = tr-TR?>
<?define IdSafeLanguage = tr_TR?>
<?elseif $(var.Language) = zh-CN?>
<?define IdSafeLanguage = zh_CN?>
<?elseif $(var.Language) = zh-TW?>
<?define IdSafeLanguage = zh_TW?>
<?else?>
<?define IdSafeLanguage = $(var.Language)?>
<?endif?>
<ComponentRef Id="Strings$(var.IdSafeLanguage)SettingsComp" />
<?undef IdSafeLanguage?>
<?endforeach?>
<Component Id="RemoveSettingsFolder" Guid="2D3AEF68-4E5A-4FF9-A5C0-9E53391AC754" Directory="SettingsV2AssetsInstallFolder" >
<RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
<RegistryValue Type="string" Name="RemoveSettingsFolder" Value="" KeyPath="yes"/>
@@ -55,6 +187,51 @@
<RemoveFolder Id="RemoveFolderSettingsV2OOBEAssetsFluentIconsInstallFolder" Directory="SettingsV2OOBEAssetsFluentIconsInstallFolder" On="uninstall"/>
<RemoveFolder Id="RemoveFolderSettingsV2AssetsModulesInstallFolder" Directory="SettingsV2AssetsModulesInstallFolder" On="uninstall"/>
<RemoveFolder Id="RemoveFolderSettingsV2OOBEAssetsModulesInstallFolder" Directory="SettingsV2OOBEAssetsModulesInstallFolder" On="uninstall"/>
<RemoveFolder Id="RemoveFolderSettingsStringsFolder" Directory="SettingsStringsFolder" On="uninstall"/>
<?foreach Language in $(var.LocLanguageList)?>
<!--NB: Ids can't contain hyphens-->
<?if $(var.Language) = cs-CZ?>
<?define IdSafeLanguage = cs_CZ?>
<?elseif $(var.Language) = de-DE?>
<?define IdSafeLanguage = de_DE?>
<?elseif $(var.Language) = en-US?>
<?define IdSafeLanguage = en_US?>
<?elseif $(var.Language) = es-ES?>
<?define IdSafeLanguage = es_ES?>
<?elseif $(var.Language) = fr-FR?>
<?define IdSafeLanguage = fr_FR?>
<?elseif $(var.Language) = hu-HU?>
<?define IdSafeLanguage = hu_HU?>
<?elseif $(var.Language) = it-IT?>
<?define IdSafeLanguage = it_IT?>
<?elseif $(var.Language) = ja-JP?>
<?define IdSafeLanguage = ja_JP?>
<?elseif $(var.Language) = ko-KR?>
<?define IdSafeLanguage = ko_KR?>
<?elseif $(var.Language) = nl-NL?>
<?define IdSafeLanguage = nl_NL?>
<?elseif $(var.Language) = pl-PL?>
<?define IdSafeLanguage = pl_PL?>
<?elseif $(var.Language) = pt-BR?>
<?define IdSafeLanguage = pt_BR?>
<?elseif $(var.Language) = pt-PT?>
<?define IdSafeLanguage = pt_PT?>
<?elseif $(var.Language) = ru-RU?>
<?define IdSafeLanguage = ru_RU?>
<?elseif $(var.Language) = sv-SE?>
<?define IdSafeLanguage = sv_SE?>
<?elseif $(var.Language) = tr-TR?>
<?define IdSafeLanguage = tr_TR?>
<?elseif $(var.Language) = zh-CN?>
<?define IdSafeLanguage = zh_CN?>
<?elseif $(var.Language) = zh-TW?>
<?define IdSafeLanguage = zh_TW?>
<?else?>
<?define IdSafeLanguage = $(var.Language)?>
<?endif?>
<RemoveFolder Id="RemoveFolderStrings$(var.IdSafeLanguage)Settings" Directory="Strings$(var.IdSafeLanguage)Settings" On="uninstall"/>
<?undef IdSafeLanguage?>
<?endforeach?>
</Component>
</ComponentGroup>

View File

@@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.
using System.ComponentModel.Composition;
using System.Globalization;
using System.Windows;
using System.Windows.Interop;
using ColorPicker.ViewModelContracts;
@@ -17,7 +18,21 @@ namespace ColorPicker
public MainWindow()
{
Closing += MainWindow_Closing;
Bootstrapper.InitializeContainer(this);
if (!string.IsNullOrEmpty(MainViewModel.LanguageTag))
{
try
{
ColorPicker.Properties.Resources.Culture = new System.Globalization.CultureInfo(MainViewModel.LanguageTag);
}
catch (CultureNotFoundException)
{
// Add logging here
}
}
InitializeComponent();
DataContext = this;
Show(); // Call show just to make sure source is initialized at startup.

View File

@@ -28,6 +28,8 @@ namespace ColorPicker.Settings
SettingItem<bool> ShowColorName { get; }
SettingItem<string> LanguageTag { get; }
void SendSettingsTelemetry();
}
}

View File

@@ -10,6 +10,7 @@ using System.IO;
using System.IO.Abstractions;
using System.Text.Json;
using System.Threading;
using System.Windows;
using ColorPicker.Common;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Library;
@@ -25,6 +26,7 @@ namespace ColorPicker.Settings
private readonly ISettingsUtils _settingsUtils;
private const string ColorPickerModuleName = "ColorPicker";
private const string ColorPickerHistoryFilename = "colorHistory.json";
private const string LanguageFilename = "language.json";
private const string DefaultActivationShortcut = "Ctrl + Break";
private const int MaxNumberOfRetry = 5;
private const int SettingsReadOnChangeDelayInMs = 300;
@@ -47,8 +49,10 @@ namespace ColorPicker.Settings
ColorHistoryLimit = new SettingItem<int>(20);
ColorHistory.CollectionChanged += ColorHistory_CollectionChanged;
ShowColorName = new SettingItem<bool>(false);
LanguageTag = new SettingItem<string>(string.Empty);
LoadSettingsFromJson();
LoadLanguage();
// delay loading settings on change by some time to avoid file in use exception
_watcher = Helper.GetFileWatcher(ColorPickerModuleName, "settings.json", () => throttledActionInvoker.ScheduleAction(LoadSettingsFromJson, SettingsReadOnChangeDelayInMs));
@@ -80,6 +84,22 @@ namespace ColorPicker.Settings
public SettingItem<bool> ShowColorName { get; }
public SettingItem<string> LanguageTag { get; private set; }
private void LoadLanguage()
{
string filePath = _settingsUtils.GetSettingsFilePath(string.Empty, LanguageFilename);
if (!File.Exists(filePath))
{
LanguageTag.Value = string.Empty;
}
else
{
string jsonSettingsString = System.IO.File.ReadAllText(filePath);
LanguageTag.Value = JsonSerializer.Deserialize<OutGoingLanguageSettings>(jsonSettingsString).LanguageTag;
}
}
private void LoadSettingsFromJson()
{
// TODO this IO call should by Async, update GetFileWatcher helper to support async

View File

@@ -28,6 +28,11 @@ namespace ColorPicker.ViewModelContracts
/// </summary>
bool ShowColorName { get; }
/// <summary>
/// Gets a value indicating the language of the app
/// </summary>
string LanguageTag { get; }
void RegisterWindowHandle(System.Windows.Interop.HwndSource hwndSource);
}
}

View File

@@ -41,6 +41,11 @@ namespace ColorPicker.ViewModels
/// </summary>
private string _colorName;
/// <summary>
/// Backing field for <see cref="LanguageTag"/>
/// </summary>
private string _languageTag;
[ImportingConstructor]
public MainViewModel(
IMouseInfoProvider mouseInfoProvider,
@@ -76,6 +81,8 @@ namespace ColorPicker.ViewModels
_userSettings.ShowColorName.PropertyChanged += (s, e) => { OnPropertyChanged(nameof(ShowColorName)); };
LanguageTag = _userSettings.LanguageTag.Value;
// Only start a local keyboard low level hook if running as a standalone.
// Otherwise, the global keyboard hook from runner will be used to activate Color Picker through ShowColorPickerSharedEvent
// and the Escape key will be registered as a shortcut by appStateHandler when ColorPicker is being used.
@@ -122,6 +129,15 @@ namespace ColorPicker.ViewModels
}
}
public string LanguageTag
{
get => _languageTag;
private set
{
_languageTag = value;
}
}
public bool ShowColorName
{
get => _userSettings.ShowColorName.Value;

View File

@@ -69,6 +69,7 @@
<ProjectReference Include="..\..\..\..\common\interop\PowerToys.Interop.vcxproj" />
<ProjectReference Include="..\..\..\..\common\ManagedCommon\ManagedCommon.csproj" />
<ProjectReference Include="..\..\..\..\common\Common.UI\Common.UI.csproj" />
<ProjectReference Include="..\..\..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">

View File

@@ -42,6 +42,20 @@ namespace FancyZonesEditor
public MainWindow(bool spanZonesAcrossMonitors, Rect workArea)
{
var languageTag = App.FancyZonesEditorIO.LoadLanguage();
if (!string.IsNullOrEmpty(languageTag))
{
try
{
FancyZonesEditor.Properties.Resources.Culture = new System.Globalization.CultureInfo(languageTag);
}
catch (CultureNotFoundException ex)
{
Logger.LogError("CultureNotFoundException: " + ex.Message);
}
}
InitializeComponent();
_createLayoutAnnounce = (TextBlock)FindName("LayoutCreationAnnounce");
DataContext = _settings;

View File

@@ -14,6 +14,7 @@ using System.Threading.Tasks;
using System.Windows;
using FancyZonesEditor.Models;
using ManagedCommon;
using Microsoft.PowerToys.Settings.UI.Library;
namespace FancyZonesEditor.Utils
{
@@ -37,6 +38,7 @@ namespace FancyZonesEditor.Utils
private const string CustomLayoutsFile = "\\Microsoft\\PowerToys\\FancyZones\\custom-layouts.json";
private const string DefaultLayoutsFile = "\\Microsoft\\PowerToys\\FancyZones\\default-layouts.json";
private const string ParamsFile = "\\Microsoft\\PowerToys\\FancyZones\\editor-parameters.json";
private const string LanguageFile = "\\Microsoft\\PowerToys\\language.json";
// Non-localizable string: default virtual desktop id
private const string DefaultVirtualDesktopGuid = "{00000000-0000-0000-0000-000000000000}";
@@ -63,6 +65,8 @@ namespace FancyZonesEditor.Utils
public string FancyZonesEditorParamsFile { get; private set; }
public string GlobalLanguageFile { get; private set; }
private enum CmdArgs
{
PowerToysPID = 0,
@@ -332,6 +336,31 @@ namespace FancyZonesEditor.Utils
FancyZonesCustomLayoutsFile = localAppDataDir + CustomLayoutsFile;
FancyZonesDefaultLayoutsFile = localAppDataDir + DefaultLayoutsFile;
FancyZonesEditorParamsFile = localAppDataDir + ParamsFile;
GlobalLanguageFile = localAppDataDir + LanguageFile;
}
public string LoadLanguage()
{
string ret = string.Empty;
if (!File.Exists(GlobalLanguageFile))
{
return string.Empty;
}
else
{
try
{
string jsonSettingsString = System.IO.File.ReadAllText(GlobalLanguageFile);
ret = JsonSerializer.Deserialize<OutGoingLanguageSettings>(jsonSettingsString).LanguageTag;
}
catch (Exception)
{
return string.Empty;
}
}
return ret;
}
public ParsingResult ParseParams()

View File

@@ -521,9 +521,9 @@ namespace ImageResizer.Models
Assert.IsTrue(File.Exists(_directory + @"\nul_.png"));
}
private static Settings Settings(Action<Settings> action = null)
private static ImageResizerSettings Settings(Action<ImageResizerSettings> action = null)
{
var settings = new Settings()
var settings = new ImageResizerSettings()
{
SelectedSizeIndex = 0,
};

View File

@@ -21,20 +21,20 @@ namespace ImageResizer.Properties
public SettingsTests()
{
// Change settings.json path to a temp file
Settings.SettingsPath = ".\\test_settings.json";
ImageResizerSettings.SettingsPath = ".\\test_settings.json";
}
[ClassInitialize]
public static void ClassInitialize(TestContext context)
{
// new App() needs to be created since Settings.Reload() uses App.Current to update properties on the UI thread. App() can be created only once otherwise it results in System.InvalidOperationException : Cannot create more than one System.Windows.Application instance in the same AppDomain.
// new App() needs to be created since ImageResizerSettings.Reload() uses App.Current to update properties on the UI thread. App() can be created only once otherwise it results in System.InvalidOperationException : Cannot create more than one System.Windows.Application instance in the same AppDomain.
_imageResizerApp = new App();
}
[TestMethod]
public void AllSizesPropagatesSizesCollectionEvents()
{
var settings = new Settings
var settings = new ImageResizerSettings
{
CustomSize = new CustomSize(),
};
@@ -53,7 +53,7 @@ namespace ImageResizer.Properties
[TestMethod]
public void AllSizesPropagatesSizesPropertyEvents()
{
var settings = new Settings
var settings = new ImageResizerSettings
{
CustomSize = new CustomSize(),
};
@@ -77,7 +77,7 @@ namespace ImageResizer.Properties
[TestMethod]
public void AllSizesContainsSizes()
{
var settings = new Settings
var settings = new ImageResizerSettings
{
CustomSize = new CustomSize(),
};
@@ -89,7 +89,7 @@ namespace ImageResizer.Properties
[TestMethod]
public void AllSizesContainsCustomSize()
{
var settings = new Settings
var settings = new ImageResizerSettings
{
CustomSize = new CustomSize(),
};
@@ -102,7 +102,7 @@ namespace ImageResizer.Properties
public void AllSizesHandlesPropertyEventsForCustomSize()
{
var originalCustomSize = new CustomSize();
var settings = new Settings
var settings = new ImageResizerSettings
{
CustomSize = originalCustomSize,
};
@@ -127,7 +127,7 @@ namespace ImageResizer.Properties
[TestMethod]
public void FileNameFormatWorks()
{
var settings = new Settings { FileName = "{T}%1e%2s%3t%4%5%6%7" };
var settings = new ImageResizerSettings { FileName = "{T}%1e%2s%3t%4%5%6%7" };
var result = settings.FileNameFormat;
@@ -140,7 +140,7 @@ namespace ImageResizer.Properties
[DataRow(2)]
public void SelectedSizeReturnsCustomSizeWhenOutOfRange(int index)
{
var settings = new Settings
var settings = new ImageResizerSettings
{
SelectedSizeIndex = index,
CustomSize = new CustomSize(),
@@ -155,7 +155,7 @@ namespace ImageResizer.Properties
[TestMethod]
public void SelectedSizeReturnsSizeWhenInRange()
{
var settings = new Settings
var settings = new ImageResizerSettings
{
SelectedSizeIndex = 0,
};
@@ -169,7 +169,7 @@ namespace ImageResizer.Properties
[TestMethod]
public void IDataErrorInfoErrorReturnsEmpty()
{
var settings = new Settings();
var settings = new ImageResizerSettings();
var result = ((IDataErrorInfo)settings).Error;
@@ -181,7 +181,7 @@ namespace ImageResizer.Properties
[DataRow(101)]
public void IDataErrorInfoItemJpegQualityLevelReturnsErrorWhenOutOfRange(int value)
{
var settings = new Settings { JpegQualityLevel = value };
var settings = new ImageResizerSettings { JpegQualityLevel = value };
var result = ((IDataErrorInfo)settings)["JpegQualityLevel"];
@@ -196,7 +196,7 @@ namespace ImageResizer.Properties
[DataRow(100)]
public void IDataErrorInfoItemJpegQualityLevelReturnsEmptyWhenInRange(int value)
{
var settings = new Settings { JpegQualityLevel = value };
var settings = new ImageResizerSettings { JpegQualityLevel = value };
var result = ((IDataErrorInfo)settings)["JpegQualityLevel"];
@@ -206,7 +206,7 @@ namespace ImageResizer.Properties
[TestMethod]
public void IDataErrorInfoItemReturnsEmptyWhenNotJpegQualityLevel()
{
var settings = new Settings();
var settings = new ImageResizerSettings();
var result = ((IDataErrorInfo)settings)["Unknown"];
@@ -217,56 +217,56 @@ namespace ImageResizer.Properties
public void ReloadCreatesFileWhenFileNotFound()
{
// Arrange
var settings = new Settings();
var settings = new ImageResizerSettings();
// Assert
Assert.IsFalse(System.IO.File.Exists(Settings.SettingsPath));
Assert.IsFalse(System.IO.File.Exists(ImageResizerSettings.SettingsPath));
// Act
settings.Reload();
// Assert
Assert.IsTrue(System.IO.File.Exists(Settings.SettingsPath));
Assert.IsTrue(System.IO.File.Exists(ImageResizerSettings.SettingsPath));
}
[TestMethod]
public void SaveCreatesFile()
{
// Arrange
var settings = new Settings();
var settings = new ImageResizerSettings();
// Assert
Assert.IsFalse(System.IO.File.Exists(Settings.SettingsPath));
Assert.IsFalse(System.IO.File.Exists(ImageResizerSettings.SettingsPath));
// Act
settings.Save();
// Assert
Assert.IsTrue(System.IO.File.Exists(Settings.SettingsPath));
Assert.IsTrue(System.IO.File.Exists(ImageResizerSettings.SettingsPath));
}
[TestMethod]
public void SaveJsonIsReadableByReload()
{
// Arrange
var settings = new Settings();
var settings = new ImageResizerSettings();
// Assert
Assert.IsFalse(System.IO.File.Exists(Settings.SettingsPath));
Assert.IsFalse(System.IO.File.Exists(ImageResizerSettings.SettingsPath));
// Act
settings.Save();
settings.Reload(); // If the JSON file created by Save() is not readable this function will throw an error
// Assert
Assert.IsTrue(System.IO.File.Exists(Settings.SettingsPath));
Assert.IsTrue(System.IO.File.Exists(ImageResizerSettings.SettingsPath));
}
[TestMethod]
public void ReloadRaisesPropertyChanged()
{
// Arrange
var settings = new Settings();
var settings = new ImageResizerSettings();
settings.Save(); // To create the settings file
var shrinkOnlyChanged = false;
@@ -349,7 +349,7 @@ namespace ImageResizer.Properties
[TestMethod]
public void SystemTextJsonDeserializesCorrectly()
{
// Generated Settings file in 0.72
// Generated ImageResizerSettings file in 0.72
var defaultInput =
"{\r\n \"properties\": {\r\n \"imageresizer_selectedSizeIndex\": {\r\n \"value\": 1\r\n },\r\n \"imageresizer_shrinkOnly\": {\r\n \"value\": true\r\n },\r\n \"imageresizer_replace\": {\r\n \"value\": true\r\n },\r\n \"imageresizer_ignoreOrientation\": {\r\n \"value\": false\r\n },\r\n \"imageresizer_jpegQualityLevel\": {\r\n \"value\": 91\r\n },\r\n \"imageresizer_pngInterlaceOption\": {\r\n \"value\": 1\r\n },\r\n \"imageresizer_tiffCompressOption\": {\r\n \"value\": 1\r\n },\r\n \"imageresizer_fileName\": {\r\n \"value\": \"%1 %1 (%2)\"\r\n },\r\n \"imageresizer_sizes\": {\r\n \"value\": [\r\n {\r\n \"Id\": 0,\r\n \"ExtraBoxOpacity\": 100,\r\n \"EnableEtraBoxes\": true,\r\n \"name\": \"Small-NotDefault\",\r\n \"fit\": 1,\r\n \"width\": 854,\r\n \"height\": 480,\r\n \"unit\": 3\r\n },\r\n {\r\n \"Id\": 3,\r\n \"ExtraBoxOpacity\": 100,\r\n \"EnableEtraBoxes\": true,\r\n \"name\": \"Phone\",\r\n \"fit\": 1,\r\n \"width\": 320,\r\n \"height\": 568,\r\n \"unit\": 3\r\n }\r\n ]\r\n },\r\n \"imageresizer_keepDateModified\": {\r\n \"value\": false\r\n },\r\n \"imageresizer_fallbackEncoder\": {\r\n \"value\": \"19e4a5aa-5662-4fc5-a0c0-1758028e1057\"\r\n },\r\n \"imageresizer_customSize\": {\r\n \"value\": {\r\n \"Id\": 4,\r\n \"ExtraBoxOpacity\": 100,\r\n \"EnableEtraBoxes\": true,\r\n \"name\": \"custom\",\r\n \"fit\": 1,\r\n \"width\": 1024,\r\n \"height\": 640,\r\n \"unit\": 3\r\n }\r\n }\r\n },\r\n \"name\": \"Image Resizer\",\r\n \"version\": \"1\"\r\n}";
@@ -384,9 +384,9 @@ namespace ImageResizer.Properties
[TestCleanup]
public void TestCleanUp()
{
if (System.IO.File.Exists(Settings.SettingsPath))
if (System.IO.File.Exists(ImageResizerSettings.SettingsPath))
{
System.IO.File.Delete(Settings.SettingsPath);
System.IO.File.Delete(ImageResizerSettings.SettingsPath);
}
}
}

View File

@@ -37,7 +37,7 @@ namespace ImageResizer
var batch = ResizeBatch.FromCommandLine(Console.In, e?.Args);
// TODO: Add command-line parameters that can be used in lieu of the input page (issue #14)
var mainWindow = new MainWindow(new MainViewModel(batch, Settings.Default));
var mainWindow = new MainWindow(new MainViewModel(batch, ImageResizerSettings.Default));
mainWindow.Show();
// Temporary workaround for issue #1273

View File

@@ -63,6 +63,7 @@
<ProjectReference Include="..\..\..\common\GPOWrapperProjection\GPOWrapperProjection.csproj" />
<ProjectReference Include="..\..\..\common\interop\PowerToys.Interop.vcxproj" />
<ProjectReference Include="..\..\..\common\Common.UI\Common.UI.csproj" />
<ProjectReference Include="..\..\..\settings-ui\Settings.UI.Library\Settings.UI.Library.csproj" />
</ItemGroup>
<ItemGroup>
<Compile Update="Properties\Resources.Designer.cs">

View File

@@ -116,6 +116,6 @@ namespace ImageResizer.Models
}
protected virtual void Execute(string file)
=> new ResizeOperation(file, DestinationDirectory, Settings.Default).Execute();
=> new ResizeOperation(file, DestinationDirectory, ImageResizerSettings.Default).Execute();
}
}

View File

@@ -25,7 +25,7 @@ namespace ImageResizer.Models
private readonly string _file;
private readonly string _destinationDirectory;
private readonly Settings _settings;
private readonly ImageResizerSettings _settings;
// Filenames to avoid according to https://learn.microsoft.com/windows/win32/fileio/naming-a-file#file-and-directory-names
private static readonly string[] _avoidFilenames =
@@ -35,7 +35,7 @@ namespace ImageResizer.Models
"LPT1", "LPT2", "LPT3", "LPT4", "LPT5", "LPT6", "LPT7", "LPT8", "LPT9",
};
public ResizeOperation(string file, string destinationDirectory, Settings settings)
public ResizeOperation(string file, string destinationDirectory, ImageResizerSettings settings)
{
_file = file;
_destinationDirectory = destinationDirectory;

View File

@@ -9,16 +9,18 @@ using System.Collections.ObjectModel;
using System.Collections.Specialized;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.IO.Abstractions;
using System.Text.Json;
using System.Text.Json.Serialization;
using System.Threading;
using System.Windows.Media.Imaging;
using ImageResizer.Models;
using OutGoingLanguageSettings = Microsoft.PowerToys.Settings.UI.Library.OutGoingLanguageSettings;
namespace ImageResizer.Properties
{
public sealed partial class Settings : IDataErrorInfo, INotifyPropertyChanged
public sealed partial class ImageResizerSettings : IDataErrorInfo, INotifyPropertyChanged
{
private static readonly IFileSystem _fileSystem = new FileSystem();
private static readonly JsonSerializerOptions _jsonSerializerOptions = new JsonSerializerOptions
@@ -30,6 +32,7 @@ namespace ImageResizer.Properties
// Used to synchronize access to the settings.json file
private static Mutex _jsonMutex = new Mutex();
private static string _settingsPath = _fileSystem.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "Image Resizer", "settings.json");
private static string _languagePath = _fileSystem.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "language.json");
private string _fileNameFormat;
private bool _shrinkOnly;
private int _selectedSizeIndex;
@@ -43,8 +46,9 @@ namespace ImageResizer.Properties
private bool _keepDateModified;
private System.Guid _fallbackEncoder;
private CustomSize _customSize;
private string _languageTag;
public Settings()
public ImageResizerSettings()
{
SelectedSizeIndex = 0;
ShrinkOnly = false;
@@ -66,6 +70,21 @@ namespace ImageResizer.Properties
FallbackEncoder = new System.Guid("19e4a5aa-5662-4fc5-a0c0-1758028e1057");
CustomSize = new CustomSize(ResizeFit.Fit, 1024, 640, ResizeUnit.Pixel);
AllSizes = new AllSizesCollection(this);
LoadLanguage();
}
private void LoadLanguage()
{
if (!File.Exists(_languagePath))
{
LanguageTag = string.Empty;
}
else
{
string jsonSettingsString = System.IO.File.ReadAllText(_languagePath);
LanguageTag = JsonSerializer.Deserialize<OutGoingLanguageSettings>(jsonSettingsString).LanguageTag;
}
}
[JsonIgnore]
@@ -134,7 +153,7 @@ namespace ImageResizer.Properties
private ObservableCollection<ResizeSize> _sizes;
private CustomSize _customSize;
public AllSizesCollection(Settings settings)
public AllSizesCollection(ImageResizerSettings settings)
{
_sizes = settings.Sizes;
_customSize = settings.CustomSize;
@@ -227,10 +246,10 @@ namespace ImageResizer.Properties
}
}
private static Settings defaultInstance = new Settings();
private static ImageResizerSettings defaultInstance = new ImageResizerSettings();
[JsonIgnore]
public static Settings Default
public static ImageResizerSettings Default
{
get
{
@@ -402,6 +421,15 @@ namespace ImageResizer.Properties
}
}
public string LanguageTag
{
get => _languageTag;
set
{
_languageTag = value;
}
}
public static string SettingsPath { get => _settingsPath; set => _settingsPath = value; }
public event PropertyChangedEventHandler PropertyChanged;
@@ -444,7 +472,7 @@ namespace ImageResizer.Properties
}
string jsonData = _fileSystem.File.ReadAllText(SettingsPath);
var jsonSettings = new Settings();
var jsonSettings = new ImageResizerSettings();
try
{
jsonSettings = JsonSerializer.Deserialize<SettingsWrapper>(jsonData, _jsonSerializerOptions)?.Properties;

View File

@@ -15,6 +15,6 @@ namespace ImageResizer.Properties
public string Version { get; set; } = "1";
[JsonPropertyName("properties")]
public Settings Properties { get; set; }
public ImageResizerSettings Properties { get; set; }
}
}

View File

@@ -35,7 +35,7 @@ namespace ImageResizer.ViewModels
};
}
public AdvancedViewModel(Settings settings)
public AdvancedViewModel(ImageResizerSettings settings)
{
RemoveSizeCommand = new RelayCommand<ResizeSize>(RemoveSize);
AddSizeCommand = new RelayCommand(AddSize);
@@ -44,7 +44,7 @@ namespace ImageResizer.ViewModels
public static IDictionary<Guid, string> EncoderMap { get; } = InitEncoderMap();
public Settings Settings { get; }
public ImageResizerSettings Settings { get; }
public static string Version
=> typeof(AdvancedViewModel).Assembly.GetCustomAttribute<AssemblyInformationalVersionAttribute>()

View File

@@ -32,7 +32,7 @@ namespace ImageResizer.ViewModels
}
public InputViewModel(
Settings settings,
ImageResizerSettings settings,
MainViewModel mainViewModel,
IMainView mainView,
ResizeBatch batch)
@@ -53,7 +53,7 @@ namespace ImageResizer.ViewModels
EnterKeyPressedCommand = new RelayCommand<KeyPressParams>(HandleEnterKeyPress);
}
public Settings Settings { get; }
public ImageResizerSettings Settings { get; }
public ICommand ResizeCommand { get; }

View File

@@ -13,16 +13,18 @@ namespace ImageResizer.ViewModels
{
public class MainViewModel : Observable
{
private readonly Settings _settings;
private readonly ImageResizerSettings _settings;
private readonly ResizeBatch _batch;
private object _currentPage;
private double _progress;
private string _languageTag;
public MainViewModel(ResizeBatch batch, Settings settings)
public MainViewModel(ResizeBatch batch, ImageResizerSettings settings)
{
_batch = batch;
_settings = settings;
_languageTag = settings.LanguageTag;
LoadCommand = new RelayCommand<IMainView>(Load);
}
@@ -40,6 +42,12 @@ namespace ImageResizer.ViewModels
set => Set(ref _progress, value);
}
public string LanguageTag
{
get => _languageTag;
set => Set(ref _languageTag, value);
}
public void Load(IMainView view)
{
if (_batch.Files.Count == 0)

View File

@@ -4,6 +4,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using ImageResizer.ViewModels;
using Microsoft.Win32;
@@ -17,6 +18,19 @@ namespace ImageResizer.Views
public MainWindow(MainViewModel viewModel)
{
DataContext = viewModel;
if (!string.IsNullOrEmpty(viewModel.LanguageTag))
{
try
{
ImageResizer.Properties.Resources.Culture = new System.Globalization.CultureInfo(viewModel.LanguageTag);
}
catch (CultureNotFoundException)
{
// Add logging here
}
}
Wpf.Ui.Appearance.Watcher.Watch(this);
InitializeComponent();
}

View File

@@ -140,11 +140,24 @@ namespace PowerLauncher
StringMatcher.Instance = _stringMatcher;
_stringMatcher.UserSettingSearchPrecision = _settings.QuerySearchPrecision;
_settingsReader = new SettingsReader(_settings, _themeManager);
_settingsReader.ReadSettings();
if (!string.IsNullOrEmpty(_settings.Language))
{
try
{
PowerLauncher.Properties.Resources.Culture = new System.Globalization.CultureInfo(_settings.Language);
}
catch (CultureNotFoundException ex)
{
Log.Exception("Error setting language: ", ex, GetType());
}
}
_mainVM = new MainViewModel(_settings, NativeThreadCTS.Token);
_mainWindow = new MainWindow(_settings, _mainVM, NativeThreadCTS.Token);
API = new PublicAPIInstance(_settingsVM, _mainVM, _alphabet, _themeManager);
_settingsReader = new SettingsReader(_settings, _themeManager);
_settingsReader.ReadSettings();
PluginManager.InitializePlugins(API);

View File

@@ -4,6 +4,7 @@
using System;
using System.ComponentModel;
using System.Globalization;
using System.Linq;
using System.Reactive.Linq;
using System.Runtime.InteropServices;

View File

@@ -2,6 +2,7 @@
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.Abstractions;
@@ -44,6 +45,36 @@ namespace PowerLauncher
// Apply theme at startup
_themeManager.ChangeTheme(_settings.Theme, true);
LoadLanguage();
}
private void LoadLanguage()
{
FileSystem fs = new FileSystem();
string languagePath = fs.Path.Combine(System.Environment.GetFolderPath(System.Environment.SpecialFolder.LocalApplicationData), "Microsoft", "PowerToys", "language.json");
if (fs.File.Exists(languagePath))
{
try
{
string languageJson = fs.File.ReadAllText(languagePath);
var language = System.Text.Json.JsonSerializer.Deserialize<OutGoingLanguageSettings>(languageJson);
if (language != null)
{
_settings.Language = language.LanguageTag;
}
}
catch (JsonException e)
{
Log.Exception("Exception when loading language file", e, GetType());
}
}
else
{
_settings.Language = string.Empty;
}
}
public void CreateSettingsIfNotExists()

View File

@@ -177,7 +177,8 @@ namespace Wox.Infrastructure.UserSettings
}
}
public string Language { get; set; } = "en";
[JsonIgnore]
public string Language { get; set; } = string.Empty;
public Theme Theme { get; set; } = Theme.System;

View File

@@ -238,11 +238,17 @@ void dispatch_received_json(const std::wstring& json_to_parse)
}
else if (name == L"killrunner")
{
const auto pt_main_window = FindWindowW(pt_tray_icon_window_class, nullptr);
if (pt_main_window != nullptr)
{
const auto pt_main_window = FindWindowW(pt_tray_icon_window_class, nullptr);
if (pt_main_window != nullptr)
{
SendMessageW(pt_main_window, WM_CLOSE, 0, 0);
}
}
}
else if (name == L"language")
{
constexpr const wchar_t* language_filename = L"\\language.json";
const std::wstring save_file_location = PTSettingsHelper::get_root_save_folder_location() + language_filename;
json::to_file(save_file_location, j);
}
}
return;

View File

@@ -0,0 +1,50 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using System.IO.Abstractions;
using System.Text.Json;
using Microsoft.PowerToys.Settings.UI.Library;
namespace Settings.UI.Library
{
public class LanguageModel
{
public const string SettingsFilePath = "\\Microsoft\\PowerToys\\";
public const string SettingsFile = "language.json";
public string Tag { get; set; }
public string ResourceID { get; set; }
public string Language { get; set; }
public static string LoadSetting()
{
FileSystem fileSystem = new FileSystem();
var localAppDataDir = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData);
var file = localAppDataDir + SettingsFilePath + SettingsFile;
if (fileSystem.File.Exists(file))
{
try
{
Stream inputStream = fileSystem.File.Open(file, FileMode.Open);
StreamReader reader = new StreamReader(inputStream);
string data = reader.ReadToEnd();
inputStream.Close();
reader.Dispose();
return JsonSerializer.Deserialize<OutGoingLanguageSettings>(data).LanguageTag;
}
catch (Exception)
{
}
}
return string.Empty;
}
}
}

View File

@@ -0,0 +1,29 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Microsoft.PowerToys.Settings.UI.Library
{
public class OutGoingLanguageSettings
{
[JsonPropertyName("language")]
public string LanguageTag { get; set; }
public OutGoingLanguageSettings()
{
}
public OutGoingLanguageSettings(string language)
{
LanguageTag = language;
}
public override string ToString()
{
return JsonSerializer.Serialize(this);
}
}
}

View File

@@ -4,6 +4,7 @@
using System;
using System.Globalization;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.UI.Xaml.Data;
namespace Microsoft.PowerToys.Settings.UI.Converters
@@ -21,9 +22,9 @@ namespace Microsoft.PowerToys.Settings.UI.Converters
string targetValue = string.Empty;
switch (value)
{
case 0: targetValue = Helpers.ResourceLoaderInstance.ResourceLoader.GetString("ImageResizer_Fit_Fill_ThirdPersonSingular"); break;
case 1: targetValue = Helpers.ResourceLoaderInstance.ResourceLoader.GetString("ImageResizer_Fit_Fit_ThirdPersonSingular"); break;
case 2: targetValue = Helpers.ResourceLoaderInstance.ResourceLoader.GetString("ImageResizer_Fit_Stretch_ThirdPersonSingular"); break;
case 0: targetValue = LocalizerInstance.Instance.GetLocalizedString("ImageResizer_Fit_Fill_ThirdPersonSingular"); break;
case 1: targetValue = LocalizerInstance.Instance.GetLocalizedString("ImageResizer_Fit_Fit_ThirdPersonSingular"); break;
case 2: targetValue = LocalizerInstance.Instance.GetLocalizedString("ImageResizer_Fit_Stretch_ThirdPersonSingular"); break;
}
if (toLower)

View File

@@ -4,6 +4,7 @@
using System;
using System.Globalization;
using Microsoft.PowerToys.Settings.UI.Helpers;
using Microsoft.UI.Xaml.Data;
namespace Microsoft.PowerToys.Settings.UI.Converters
@@ -21,10 +22,10 @@ namespace Microsoft.PowerToys.Settings.UI.Converters
string targetValue = string.Empty;
switch (value)
{
case 0: targetValue = Helpers.ResourceLoaderInstance.ResourceLoader.GetString("ImageResizer_Unit_Centimeter"); break;
case 1: targetValue = Helpers.ResourceLoaderInstance.ResourceLoader.GetString("ImageResizer_Unit_Inch"); break;
case 2: targetValue = Helpers.ResourceLoaderInstance.ResourceLoader.GetString("ImageResizer_Unit_Percent"); break;
case 3: targetValue = Helpers.ResourceLoaderInstance.ResourceLoader.GetString("ImageResizer_Unit_Pixel"); break;
case 0: targetValue = LocalizerInstance.Instance.GetLocalizedString("ImageResizer_Unit_Centimeter"); break;
case 1: targetValue = LocalizerInstance.Instance.GetLocalizedString("ImageResizer_Unit_Inch"); break;
case 2: targetValue = LocalizerInstance.Instance.GetLocalizedString("ImageResizer_Unit_Percent"); break;
case 3: targetValue = LocalizerInstance.Instance.GetLocalizedString("ImageResizer_Unit_Pixel"); break;
}
if (toLower)

View File

@@ -0,0 +1,37 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.IO;
using System.Threading.Tasks;
using Windows.Storage;
using WinUI3Localizer;
namespace Microsoft.PowerToys.Settings.UI.Helpers
{
internal static class LocalizerInstance
{
internal static ILocalizer Instance { get; private set; }
static LocalizerInstance()
{
InitializeLocalizer().Wait();
}
private static async Task InitializeLocalizer()
{
// Initialize a "Strings" folder in the executables folder.
string stringsPath = Path.Combine(AppContext.BaseDirectory, "Strings", "Settings");
Instance = await new LocalizerBuilder()
.AddStringResourcesFolderForLanguageDictionaries(stringsPath)
.SetOptions(options =>
{
options.DefaultLanguage = "de-DE";
options.UseUidWhenLocalizedStringNotFound = true;
})
.Build();
}
}
}

View File

@@ -1,18 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.Windows.ApplicationModel.Resources;
namespace Microsoft.PowerToys.Settings.UI.Helpers
{
internal static class ResourceExtensions
{
private static readonly ResourceLoader ResLoader = ResourceLoaderInstance.ResourceLoader;
public static string GetLocalized(this string resourceKey)
{
return ResLoader.GetString(resourceKey);
}
}
}

View File

@@ -1,17 +0,0 @@
// Copyright (c) Microsoft Corporation
// The Microsoft Corporation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using Microsoft.Windows.ApplicationModel.Resources;
namespace Microsoft.PowerToys.Settings.UI.Helpers
{
internal static class ResourceLoaderInstance
{
internal static ResourceLoader ResourceLoader { get; private set; }
static ResourceLoaderInstance()
{
ResourceLoader = new Microsoft.Windows.ApplicationModel.Resources.ResourceLoader("PowerToys.Settings.pri");
}
}
}

View File

@@ -82,8 +82,9 @@
<PackageReference Include="Microsoft.Windows.CsWinRT" />
<PackageReference Include="CommunityToolkit.WinUI.UI" />
<PackageReference Include="CommunityToolkit.WinUI.UI.Controls" />
<PackageReference Include="WinUIEx" />
<PackageReference Include="Microsoft.WindowsAppSDK" />
<PackageReference Include="WinUIEx" />
<PackageReference Include="WinUI3Localizer" />
<PackageReference Include="Microsoft.WindowsAppSDK" />
<PackageReference Include="Microsoft.Windows.SDK.BuildTools" />
<PackageReference Include="Microsoft.Xaml.Behaviors.WinUI.Managed" />
<PackageReference Include="StreamJsonRpc" />
@@ -122,5 +123,9 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
<Exec Command="if not exist &quot;..\..\..\$(Platform)\$(Configuration)\WinUI3Apps\Strings\Settings\&quot; (&#xD;&#xA; mkdir &quot;..\..\..\$(Platform)\$(Configuration)\WinUI3Apps\Strings\Settings\&quot;&#xD;&#xA; xcopy &quot;Strings&quot; &quot;..\..\..\$(Platform)\$(Configuration)\WinUI3Apps\Strings\Settings&quot; /F /R /Y /I /S /C&#xD;&#xA;)" />
</Target>
</Project>

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Controls.AlphaColorPickerButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -5,6 +5,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Controls.ColorFormatEditor"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:CommunityToolkit="using:CommunityToolkit.WinUI.UI.Controls"
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -27,48 +27,47 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
public void LoadParameters()
{
ResourceLoader resourceLoader = ResourceLoaderInstance.ResourceLoader;
ParametersItemsControl.ItemsSource = new List<ColorFormatParameter>
{
new ColorFormatParameter() { Parameter = "%Re", Description = resourceLoader.GetString("Help_red") },
new ColorFormatParameter() { Parameter = "%Gr", Description = resourceLoader.GetString("Help_green") },
new ColorFormatParameter() { Parameter = "%Bl", Description = resourceLoader.GetString("Help_blue") },
new ColorFormatParameter() { Parameter = "%Al", Description = resourceLoader.GetString("Help_alpha") },
new ColorFormatParameter() { Parameter = "%Cy", Description = resourceLoader.GetString("Help_cyan") },
new ColorFormatParameter() { Parameter = "%Ma", Description = resourceLoader.GetString("Help_magenta") },
new ColorFormatParameter() { Parameter = "%Ye", Description = resourceLoader.GetString("Help_yellow") },
new ColorFormatParameter() { Parameter = "%Bk", Description = resourceLoader.GetString("Help_black_key") },
new ColorFormatParameter() { Parameter = "%Hu", Description = resourceLoader.GetString("Help_hue") },
new ColorFormatParameter() { Parameter = "%Si", Description = resourceLoader.GetString("Help_saturationI") },
new ColorFormatParameter() { Parameter = "%Sl", Description = resourceLoader.GetString("Help_saturationL") },
new ColorFormatParameter() { Parameter = "%Sb", Description = resourceLoader.GetString("Help_saturationB") },
new ColorFormatParameter() { Parameter = "%Br", Description = resourceLoader.GetString("Help_brightness") },
new ColorFormatParameter() { Parameter = "%In", Description = resourceLoader.GetString("Help_intensity") },
new ColorFormatParameter() { Parameter = "%Hn", Description = resourceLoader.GetString("Help_hueNat") },
new ColorFormatParameter() { Parameter = "%Ll", Description = resourceLoader.GetString("Help_lightnessNat") },
new ColorFormatParameter() { Parameter = "%Lc", Description = resourceLoader.GetString("Help_lightnessCIE") },
new ColorFormatParameter() { Parameter = "%Va", Description = resourceLoader.GetString("Help_value") },
new ColorFormatParameter() { Parameter = "%Wh", Description = resourceLoader.GetString("Help_whiteness") },
new ColorFormatParameter() { Parameter = "%Bn", Description = resourceLoader.GetString("Help_blackness") },
new ColorFormatParameter() { Parameter = "%Ca", Description = resourceLoader.GetString("Help_chromaticityA") },
new ColorFormatParameter() { Parameter = "%Cb", Description = resourceLoader.GetString("Help_chromaticityB") },
new ColorFormatParameter() { Parameter = "%Xv", Description = resourceLoader.GetString("Help_X_value") },
new ColorFormatParameter() { Parameter = "%Yv", Description = resourceLoader.GetString("Help_Y_value") },
new ColorFormatParameter() { Parameter = "%Zv", Description = resourceLoader.GetString("Help_Z_value") },
new ColorFormatParameter() { Parameter = "%Dv", Description = resourceLoader.GetString("Help_decimal_value_BGR") },
new ColorFormatParameter() { Parameter = "%Dr", Description = resourceLoader.GetString("Help_decimal_value_RGB") },
new ColorFormatParameter() { Parameter = "%Na", Description = resourceLoader.GetString("Help_color_name") },
new ColorFormatParameter() { Parameter = "%Re", Description = LocalizerInstance.Instance.GetLocalizedString("Help_red") },
new ColorFormatParameter() { Parameter = "%Gr", Description = LocalizerInstance.Instance.GetLocalizedString("Help_green") },
new ColorFormatParameter() { Parameter = "%Bl", Description = LocalizerInstance.Instance.GetLocalizedString("Help_blue") },
new ColorFormatParameter() { Parameter = "%Al", Description = LocalizerInstance.Instance.GetLocalizedString("Help_alpha") },
new ColorFormatParameter() { Parameter = "%Cy", Description = LocalizerInstance.Instance.GetLocalizedString("Help_cyan") },
new ColorFormatParameter() { Parameter = "%Ma", Description = LocalizerInstance.Instance.GetLocalizedString("Help_magenta") },
new ColorFormatParameter() { Parameter = "%Ye", Description = LocalizerInstance.Instance.GetLocalizedString("Help_yellow") },
new ColorFormatParameter() { Parameter = "%Bk", Description = LocalizerInstance.Instance.GetLocalizedString("Help_black_key") },
new ColorFormatParameter() { Parameter = "%Hu", Description = LocalizerInstance.Instance.GetLocalizedString("Help_hue") },
new ColorFormatParameter() { Parameter = "%Si", Description = LocalizerInstance.Instance.GetLocalizedString("Help_saturationI") },
new ColorFormatParameter() { Parameter = "%Sl", Description = LocalizerInstance.Instance.GetLocalizedString("Help_saturationL") },
new ColorFormatParameter() { Parameter = "%Sb", Description = LocalizerInstance.Instance.GetLocalizedString("Help_saturationB") },
new ColorFormatParameter() { Parameter = "%Br", Description = LocalizerInstance.Instance.GetLocalizedString("Help_brightness") },
new ColorFormatParameter() { Parameter = "%In", Description = LocalizerInstance.Instance.GetLocalizedString("Help_intensity") },
new ColorFormatParameter() { Parameter = "%Hn", Description = LocalizerInstance.Instance.GetLocalizedString("Help_hueNat") },
new ColorFormatParameter() { Parameter = "%Ll", Description = LocalizerInstance.Instance.GetLocalizedString("Help_lightnessNat") },
new ColorFormatParameter() { Parameter = "%Lc", Description = LocalizerInstance.Instance.GetLocalizedString("Help_lightnessCIE") },
new ColorFormatParameter() { Parameter = "%Va", Description = LocalizerInstance.Instance.GetLocalizedString("Help_value") },
new ColorFormatParameter() { Parameter = "%Wh", Description = LocalizerInstance.Instance.GetLocalizedString("Help_whiteness") },
new ColorFormatParameter() { Parameter = "%Bn", Description = LocalizerInstance.Instance.GetLocalizedString("Help_blackness") },
new ColorFormatParameter() { Parameter = "%Ca", Description = LocalizerInstance.Instance.GetLocalizedString("Help_chromaticityA") },
new ColorFormatParameter() { Parameter = "%Cb", Description = LocalizerInstance.Instance.GetLocalizedString("Help_chromaticityB") },
new ColorFormatParameter() { Parameter = "%Xv", Description = LocalizerInstance.Instance.GetLocalizedString("Help_X_value") },
new ColorFormatParameter() { Parameter = "%Yv", Description = LocalizerInstance.Instance.GetLocalizedString("Help_Y_value") },
new ColorFormatParameter() { Parameter = "%Zv", Description = LocalizerInstance.Instance.GetLocalizedString("Help_Z_value") },
new ColorFormatParameter() { Parameter = "%Dv", Description = LocalizerInstance.Instance.GetLocalizedString("Help_decimal_value_BGR") },
new ColorFormatParameter() { Parameter = "%Dr", Description = LocalizerInstance.Instance.GetLocalizedString("Help_decimal_value_RGB") },
new ColorFormatParameter() { Parameter = "%Na", Description = LocalizerInstance.Instance.GetLocalizedString("Help_color_name") },
};
ColorParametersItemsControl.ItemsSource = new List<ColorFormatParameter>
{
new ColorFormatParameter() { Parameter = "b", Description = resourceLoader.GetString("Help_byte") },
new ColorFormatParameter() { Parameter = "h", Description = resourceLoader.GetString("Help_hexL1") },
new ColorFormatParameter() { Parameter = "H", Description = resourceLoader.GetString("Help_hexU1") },
new ColorFormatParameter() { Parameter = "x", Description = resourceLoader.GetString("Help_hexL2") },
new ColorFormatParameter() { Parameter = "X", Description = resourceLoader.GetString("Help_hexU2") },
new ColorFormatParameter() { Parameter = "f", Description = resourceLoader.GetString("Help_floatWith") },
new ColorFormatParameter() { Parameter = "F", Description = resourceLoader.GetString("Help_floatWithout") },
new ColorFormatParameter() { Parameter = "b", Description = LocalizerInstance.Instance.GetLocalizedString("Help_byte") },
new ColorFormatParameter() { Parameter = "h", Description = LocalizerInstance.Instance.GetLocalizedString("Help_hexL1") },
new ColorFormatParameter() { Parameter = "H", Description = LocalizerInstance.Instance.GetLocalizedString("Help_hexU1") },
new ColorFormatParameter() { Parameter = "x", Description = LocalizerInstance.Instance.GetLocalizedString("Help_hexL2") },
new ColorFormatParameter() { Parameter = "X", Description = LocalizerInstance.Instance.GetLocalizedString("Help_hexU2") },
new ColorFormatParameter() { Parameter = "f", Description = LocalizerInstance.Instance.GetLocalizedString("Help_floatWith") },
new ColorFormatParameter() { Parameter = "F", Description = LocalizerInstance.Instance.GetLocalizedString("Help_floatWithout") },
};
}

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Controls.ColorPickerButton"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Controls.FancyZonesPreviewControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Loaded="FancyZonesPreviewControl_Loaded"

View File

@@ -4,6 +4,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls">
<Style BasedOn="{StaticResource DefaultFlyoutMenuButtonStyle}" TargetType="local:FlyoutMenuButton" />

View File

@@ -1,6 +1,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls">
<Style TargetType="local:IsEnabledTextBlock">

View File

@@ -1,6 +1,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls">
<x:Double x:Key="DefaultIconSize">16</x:Double>

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Controls.OOBEPageControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
d:DesignHeight="300"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Controls.PowerAccentShortcutControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -1,6 +1,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls">
<Style TargetType="controls:SettingsGroup">

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Controls.SettingsPageControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:CommunityToolkit.WinUI.UI.Controls"
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Controls.ShortcutControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -49,11 +49,9 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
return;
}
var resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader;
var newValue = (bool)(e?.NewValue ?? false);
var text = newValue ? resourceLoader.GetString("Activation_Shortcut_With_Disable_Description") : resourceLoader.GetString("Activation_Shortcut_Description");
var text = newValue ? LocalizerInstance.Instance.GetLocalizedString("Activation_Shortcut_With_Disable_Description") : LocalizerInstance.Instance.GetLocalizedString("Activation_Shortcut_Description");
description.Text = text;
}
@@ -116,7 +114,6 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
this.Unloaded += ShortcutControl_Unloaded;
hook = new HotkeySettingsControlHook(Hotkey_KeyDown, Hotkey_KeyUp, Hotkey_IsActive, FilterAccessibleKeyboardEvents);
var resourceLoader = Helpers.ResourceLoaderInstance.ResourceLoader;
if (App.GetSettingsWindow() != null)
{
@@ -127,11 +124,11 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
shortcutDialog = new ContentDialog
{
XamlRoot = this.XamlRoot,
Title = resourceLoader.GetString("Activation_Shortcut_Title"),
Title = LocalizerInstance.Instance.GetLocalizedString("Activation_Shortcut_Title"),
Content = c,
PrimaryButtonText = resourceLoader.GetString("Activation_Shortcut_Save"),
SecondaryButtonText = resourceLoader.GetString("Activation_Shortcut_Reset"),
CloseButtonText = resourceLoader.GetString("Activation_Shortcut_Cancel"),
PrimaryButtonText = LocalizerInstance.Instance.GetLocalizedString("Activation_Shortcut_Save"),
SecondaryButtonText = LocalizerInstance.Instance.GetLocalizedString("Activation_Shortcut_Reset"),
CloseButtonText = LocalizerInstance.Instance.GetLocalizedString("Activation_Shortcut_Cancel"),
DefaultButton = ContentDialogButton.Primary,
};
shortcutDialog.PrimaryButtonClick += ShortcutDialog_PrimaryButtonClick;
@@ -139,7 +136,7 @@ namespace Microsoft.PowerToys.Settings.UI.Controls
shortcutDialog.RightTapped += ShortcutDialog_Disable;
shortcutDialog.Opened += ShortcutDialog_Opened;
shortcutDialog.Closing += ShortcutDialog_Closing;
AutomationProperties.SetName(EditButton, resourceLoader.GetString("Activation_Shortcut_Title"));
AutomationProperties.SetName(EditButton, LocalizerInstance.Instance.GetLocalizedString("Activation_Shortcut_Title"));
OnAllowDisableChanged(this, null);
}

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Controls.ShortcutDialogContentControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Controls.ShortcutWithTextLabelControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Controls"

View File

@@ -5,6 +5,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Flyout.AppsListPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Flyout"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Flyout.LaunchPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:animatedVisuals="using:Microsoft.UI.Xaml.Controls.AnimatedVisuals"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Flyout.ShellPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Flyout"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.FlyoutWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:flyout="using:Microsoft.PowerToys.Settings.UI.Flyout"
xmlns:local="using:Microsoft.PowerToys.Settings.UI"
@@ -9,7 +10,7 @@
xmlns:winuiex="using:WinUIEx"
xmlns:i="using:Microsoft.Xaml.Interactivity"
xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
Title="PowerToys Settings"
Title="PowerToys a a a a a a aSettings"
IsAlwaysOnTop="True"
IsMaximizable="False"
IsMinimizable="False"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -13,6 +13,7 @@ using Microsoft.UI;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Windows.Data.Json;
using WinUI3Localizer;
using WinUIEx;
namespace Microsoft.PowerToys.Settings.UI
@@ -50,8 +51,8 @@ namespace Microsoft.PowerToys.Settings.UI
NativeMethods.SetWindowPlacement(hWnd, ref placement);
var loader = Helpers.ResourceLoaderInstance.ResourceLoader;
Title = loader.GetString("SettingsWindow_Title");
string title = LocalizerInstance.Instance.GetLocalizedString("SettingsWindow_Title");
Title = title;
// send IPC Message
ShellPage.SetDefaultSndMessageCallback(msg =>

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeAlwaysOnTop"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeAwake"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeColorPicker"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeCropAndLock"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeFancyZones"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeFileExplorer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeFileLocksmith"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeHosts"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeImageResizer"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeKBM"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeMeasureTool"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeMouseUtils"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeMouseWithoutBorders"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeOverview"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeOverviewAlternate"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -5,6 +5,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeOverviewPlaceholder"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobePastePlain"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -5,6 +5,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobePeek"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobePowerAccent"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobePowerOCR"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobePowerRename"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeRegistryPreview"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeRun"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeShellPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:animations="using:CommunityToolkit.WinUI.UI.Animations"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeShortcutGuide"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeVideoConference"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OOBE.Views.OobeWhatsNew"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.OobeWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="using:Microsoft.PowerToys.Settings.UI.OOBE.Views"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"

View File

@@ -68,8 +68,7 @@ namespace Microsoft.PowerToys.Settings.UI
this.SizeChanged += OobeWindow_SizeChanged;
var loader = Helpers.ResourceLoaderInstance.ResourceLoader;
Title = loader.GetString("OobeWindow_Title");
Title = LocalizerInstance.Instance.GetLocalizedString("OobeWindow_Title");
if (shellPage != null)
{

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer">
<SolidColorBrush x:Key="SubtleButtonBackground" Color="{ThemeResource SubtleFillColorTransparent}" />
<SolidColorBrush x:Key="SubtleButtonBackgroundPointerOver" Color="{ThemeResource SubtleFillColorSecondary}" />

View File

@@ -1,6 +1,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer">
<Style
x:Key="OobeSubtitleStyle"

View File

@@ -1,6 +1,7 @@
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer">
<ResourceDictionary.ThemeDictionaries>
<ResourceDictionary x:Key="Dark">

View File

@@ -1,4 +1,5 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="ms-appx:///SettingsXAML/Controls/SettingsGroup/SettingsGroup.xaml" />

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Views.AlwaysOnTopPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Views.AwakePage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:converters="using:Microsoft.PowerToys.Settings.UI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Views.ColorPickerPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"

View File

@@ -22,8 +22,6 @@ namespace Microsoft.PowerToys.Settings.UI.Views
public ICommand UpdateCommand => new RelayCommand(Update);
private ResourceLoader resourceLoader = ResourceLoaderInstance.ResourceLoader;
public ColorPickerPage()
{
var settingsUtils = new SettingsUtils();
@@ -89,10 +87,10 @@ namespace Microsoft.PowerToys.Settings.UI.Views
ContentDialog dialog = new ContentDialog();
dialog.XamlRoot = RootPage.XamlRoot;
dialog.Title = color.Name;
dialog.PrimaryButtonText = resourceLoader.GetString("Yes");
dialog.CloseButtonText = resourceLoader.GetString("No");
dialog.PrimaryButtonText = LocalizerInstance.Instance.GetLocalizedString("Yes");
dialog.CloseButtonText = LocalizerInstance.Instance.GetLocalizedString("No");
dialog.DefaultButton = ContentDialogButton.Primary;
dialog.Content = new TextBlock() { Text = resourceLoader.GetString("Delete_Dialog_Description") };
dialog.Content = new TextBlock() { Text = LocalizerInstance.Instance.GetLocalizedString("Delete_Dialog_Description") };
dialog.PrimaryButtonClick += (s, args) =>
{
ViewModel.DeleteModel(color);
@@ -117,12 +115,12 @@ namespace Microsoft.PowerToys.Settings.UI.Views
private async void NewFormatClick(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
{
ColorFormatDialog.Title = resourceLoader.GetString("AddCustomColorFormat");
ColorFormatDialog.Title = LocalizerInstance.Instance.GetLocalizedString("AddCustomColorFormat");
ColorFormatModel newColorFormatModel = ViewModel.GetNewColorFormatModel();
ColorFormatDialog.DataContext = newColorFormatModel;
ColorFormatDialog.Tag = string.Empty;
ColorFormatDialog.PrimaryButtonText = resourceLoader.GetString("ColorFormatSave");
ColorFormatDialog.PrimaryButtonText = LocalizerInstance.Instance.GetLocalizedString("ColorFormatSave");
ColorFormatDialog.PrimaryButtonCommand = AddCommand;
await ColorFormatDialog.ShowAsync();
}
@@ -144,11 +142,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
{
SettingsCard btn = sender as SettingsCard;
ColorFormatModel colorFormatModel = btn.DataContext as ColorFormatModel;
ColorFormatDialog.Title = resourceLoader.GetString("EditCustomColorFormat");
ColorFormatDialog.Title = LocalizerInstance.Instance.GetLocalizedString("EditCustomColorFormat");
ColorFormatDialog.DataContext = colorFormatModel;
ColorFormatDialog.Tag = new KeyValuePair<string, string>(colorFormatModel.Name, colorFormatModel.Format);
ColorFormatDialog.PrimaryButtonText = resourceLoader.GetString("ColorFormatUpdate");
ColorFormatDialog.PrimaryButtonText = LocalizerInstance.Instance.GetLocalizedString("ColorFormatUpdate");
ColorFormatDialog.PrimaryButtonCommand = UpdateCommand;
await ColorFormatDialog.ShowAsync();
}

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Views.CropAndLockPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"

View File

@@ -2,6 +2,7 @@
x:Class="Microsoft.PowerToys.Settings.UI.Views.FancyZonesPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:l="using:WinUI3Localizer"
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:labs="using:CommunityToolkit.Labs.WinUI"

Some files were not shown because too many files have changed in this diff Show More