mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 02:36:19 +02:00
[Localization] Move PowerToys Run string resources from xaml files to resx (#6165)
* Removed xaml files, added resx file and removed references for PowerLauncher project * Added resx file for wox.plugin * Moved Calculator resources to resx * Migrated resources for Folder and Indexer plugins * Migrated resources for Program and Shell plugin * Migrated resources for URI and Window Walker * Removed GetTranslation, tests need to be refactored * Removed internationalization classes * Removed Wox.Core.Resource references * Fixed Programs plugin tests * Fixed tests * Removed language xaml files from installer * Added locProject.json files * Fixed resource not found error * Reverted addition of resx file for Wox.Plugin
This commit is contained in:
@@ -17,7 +17,6 @@ namespace Wox.Test.Plugins
|
||||
{
|
||||
// Arrange
|
||||
var mock = new Mock<IPublicAPI>();
|
||||
mock.Setup(api => api.GetTranslation(It.IsAny<string>())).Returns(It.IsAny<string>());
|
||||
var pluginInitContext = new PluginInitContext() { API = mock.Object };
|
||||
var contextMenuLoader = new ContextMenuLoader(pluginInitContext);
|
||||
var searchResult = new SearchResult() { Type = ResultType.Folder, FullPath = "C:/DummyFolder" };
|
||||
@@ -28,8 +27,8 @@ namespace Wox.Test.Plugins
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(contextMenuResults.Count, 2);
|
||||
mock.Verify(x => x.GetTranslation("Microsoft_plugin_folder_copy_path"), Times.Once());
|
||||
mock.Verify(x => x.GetTranslation("Microsoft_plugin_folder_open_in_console"), Times.Once());
|
||||
Assert.AreEqual(contextMenuResults[0].Title, Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_copy_path);
|
||||
Assert.AreEqual(contextMenuResults[1].Title, Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_open_in_console);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -37,7 +36,6 @@ namespace Wox.Test.Plugins
|
||||
{
|
||||
// Arrange
|
||||
var mock = new Mock<IPublicAPI>();
|
||||
mock.Setup(api => api.GetTranslation(It.IsAny<string>())).Returns(It.IsAny<string>());
|
||||
var pluginInitContext = new PluginInitContext() { API = mock.Object };
|
||||
var contextMenuLoader = new ContextMenuLoader(pluginInitContext);
|
||||
var searchResult = new SearchResult() { Type = ResultType.File, FullPath = "C:/DummyFile.cs" };
|
||||
@@ -48,9 +46,9 @@ namespace Wox.Test.Plugins
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(contextMenuResults.Count, 3);
|
||||
mock.Verify(x => x.GetTranslation("Microsoft_plugin_folder_open_containing_folder"), Times.Once());
|
||||
mock.Verify(x => x.GetTranslation("Microsoft_plugin_folder_copy_path"), Times.Once());
|
||||
mock.Verify(x => x.GetTranslation("Microsoft_plugin_folder_open_in_console"), Times.Once());
|
||||
Assert.AreEqual(contextMenuResults[0].Title, Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_open_containing_folder);
|
||||
Assert.AreEqual(contextMenuResults[1].Title, Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_copy_path);
|
||||
Assert.AreEqual(contextMenuResults[2].Title, Microsoft.Plugin.Folder.Properties.Resources.Microsoft_plugin_folder_open_in_console);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -282,10 +282,10 @@ namespace Wox.Test.Plugins
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(contextMenuItems.Count, 4);
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_copy_path"), Times.Once());
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_run_as_administrator"), Times.Once());
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_open_containing_folder"), Times.Once());
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_open_in_console"), Times.Once());
|
||||
Assert.AreEqual(contextMenuItems[0].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_containing_folder);
|
||||
Assert.AreEqual(contextMenuItems[1].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_run_as_administrator);
|
||||
Assert.AreEqual(contextMenuItems[2].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_copy_path);
|
||||
Assert.AreEqual(contextMenuItems[3].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_in_console);
|
||||
}
|
||||
|
||||
[TestCase("item.pdf")]
|
||||
@@ -310,10 +310,9 @@ namespace Wox.Test.Plugins
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(contextMenuItems.Count, 3);
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_copy_path"), Times.Once());
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_run_as_administrator"), Times.Never());
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_open_containing_folder"), Times.Once());
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_open_in_console"), Times.Once());
|
||||
Assert.AreEqual(contextMenuItems[0].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_containing_folder);
|
||||
Assert.AreEqual(contextMenuItems[1].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_copy_path);
|
||||
Assert.AreEqual(contextMenuItems[2].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_in_console);
|
||||
}
|
||||
|
||||
[TestCase("C:/DummyFolder")]
|
||||
@@ -336,10 +335,8 @@ namespace Wox.Test.Plugins
|
||||
|
||||
// Assert
|
||||
Assert.AreEqual(contextMenuItems.Count, 2);
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_copy_path"), Times.Once());
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_run_as_administrator"), Times.Never());
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_open_containing_folder"), Times.Never());
|
||||
mockapi.Verify(m => m.GetTranslation("Microsoft_plugin_indexer_open_in_console"), Times.Once());
|
||||
Assert.AreEqual(contextMenuItems[0].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_copy_path);
|
||||
Assert.AreEqual(contextMenuItems[1].Title, Microsoft.Plugin.Indexer.Properties.Resources.Microsoft_plugin_indexer_open_in_console);
|
||||
}
|
||||
|
||||
[TestCase(0, false, ExpectedResult = true)]
|
||||
|
||||
Reference in New Issue
Block a user