From 46cf9a23340463c3ede971ebb11c43c42e52c85c Mon Sep 17 00:00:00 2001 From: Heiko <61519853+htcfreek@users.noreply.github.com> Date: Tue, 28 Jun 2022 20:21:08 +0200 Subject: [PATCH] [PTRun][Plugins]Translation fixes and improvements (#19037) * add resx comment to sys plugin (#18843) * number examples calc plugin (#18934) * TD description fix (#17377) * small fixes * add comments * make spell checker happy --- .../Main.cs | 5 ++-- .../Properties/Resources.Designer.cs | 4 +-- .../Properties/Resources.resx | 6 ++-- .../Properties/Resources.resx | 1 + .../Main.cs | 8 +++-- .../Properties/Resources.Designer.cs | 29 ++++++++++++++++++- .../Properties/Resources.resx | 13 +++++++-- 7 files changed, 54 insertions(+), 12 deletions(-) diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Main.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Main.cs index aa6a9ef775..d9b7626efc 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Main.cs @@ -34,18 +34,19 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator public IEnumerable AdditionalOptions => new List() { + // The number examples has to be created at runtime to prevent translation. new PluginAdditionalOption() { Key = "InputUseEnglishFormat", DisplayLabel = Resources.wox_plugin_calculator_in_en_format, - DisplayDescription = Resources.wox_plugin_calculator_in_en_format_description, + DisplayDescription = string.Format(CultureInfo.CurrentCulture, Resources.wox_plugin_calculator_in_en_format_description, 1000.55.ToString("N2", new CultureInfo("en-us"))), Value = false, }, new PluginAdditionalOption() { Key = "OutputUseEnglishFormat", DisplayLabel = Resources.wox_plugin_calculator_out_en_format, - DisplayDescription = Resources.wox_plugin_calculator_out_en_format_description, + DisplayDescription = string.Format(CultureInfo.CurrentCulture, Resources.wox_plugin_calculator_out_en_format_description, 1000.55.ToString("G", new CultureInfo("en-us"))), Value = false, }, }; diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs index 1268957d4e..ff44645a15 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.Designer.cs @@ -115,7 +115,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.Properties { } /// - /// Looks up a localized string similar to Ignores your system setting and expects numbers in the format '1,000.50'. + /// Looks up a localized string similar to Ignores your system setting and expects numbers in the format '{0}'.. /// public static string wox_plugin_calculator_in_en_format_description { get { @@ -151,7 +151,7 @@ namespace Microsoft.PowerToys.Run.Plugin.Calculator.Properties { } /// - /// Looks up a localized string similar to Ignores your system setting and returns numbers in the format '1000.50'. + /// Looks up a localized string similar to Ignores your system setting and returns numbers in the format '{0}'.. /// public static string wox_plugin_calculator_out_en_format_description { get { diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.resx b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.resx index b3affa13f0..523710465d 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.resx +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.Calculator/Properties/Resources.resx @@ -148,12 +148,14 @@ Use English (United States) number format for input - Ignores your system setting and expects numbers in the format '1,000.50' + Ignores your system setting and expects numbers in the format '{0}'. + {0} is a placeholder and will be replaced in code. Use English (United States) number format for output - Ignores your system setting and returns numbers in the format '1000.50' + Ignores your system setting and returns numbers in the format '{0}'. + {0} is a placeholder and will be replaced in code. \ No newline at end of file diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Properties/Resources.resx b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Properties/Resources.resx index 1167520da3..ac60fb3d6d 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Properties/Resources.resx +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.System/Properties/Resources.resx @@ -317,6 +317,7 @@ Type + Means type like category. Here it means network interface type (ethernet, wifi, ...). UEFI Firmware Settings diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Main.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Main.cs index 3a7347a61f..3c799c8097 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Main.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Main.cs @@ -92,9 +92,11 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate public string GetTranslatedPluginDescription() { - string timeExample = DateTime.Now.ToString("T", CultureInfo.CurrentCulture); - string dateExample = DateTime.Now.ToString("d", CultureInfo.CurrentCulture); - return string.Format(CultureInfo.CurrentCulture, Resources.Microsoft_plugin_timedate_plugin_description, dateExample, timeExample); + // The extra strings for the examples are required for correct translations. + string timeExample = Resources.Microsoft_plugin_timedate_plugin_description_example_time + "::" + DateTime.Now.ToString("T", CultureInfo.CurrentCulture); + string dayExample = Resources.Microsoft_plugin_timedate_plugin_description_example_day + "::" + DateTime.Now.ToString("d", CultureInfo.CurrentCulture); + string calendarWeekExample = Resources.Microsoft_plugin_timedate_plugin_description_example_calendarWeek + "::" + DateTime.Now.ToString("d", CultureInfo.CurrentCulture); + return string.Format(CultureInfo.CurrentCulture, Resources.Microsoft_plugin_timedate_plugin_description, Resources.Microsoft_plugin_timedate_plugin_description_example_day, dayExample, timeExample, calendarWeekExample); } public string GetTranslatedPluginTitle() diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Properties/Resources.Designer.cs b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Properties/Resources.Designer.cs index 2c535a5700..a7871ab040 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Properties/Resources.Designer.cs +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Properties/Resources.Designer.cs @@ -286,7 +286,7 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.Properties { } /// - /// Looks up a localized string similar to Provides time and date values for the system time or a custom time stamp (Examples: 'day', 'day::{0}', 'time::{1}', 'calendar week::{0}'). + /// Looks up a localized string similar to Provides time and date values for the system time or a custom time stamp (Examples: '{0}', '{1}', '{2}', '{3}'). /// internal static string Microsoft_plugin_timedate_plugin_description { get { @@ -294,6 +294,33 @@ namespace Microsoft.PowerToys.Run.Plugin.TimeDate.Properties { } } + /// + /// Looks up a localized string similar to Calendar week. + /// + internal static string Microsoft_plugin_timedate_plugin_description_example_calendarWeek { + get { + return ResourceManager.GetString("Microsoft_plugin_timedate_plugin_description_example_calendarWeek", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Day. + /// + internal static string Microsoft_plugin_timedate_plugin_description_example_day { + get { + return ResourceManager.GetString("Microsoft_plugin_timedate_plugin_description_example_day", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Time. + /// + internal static string Microsoft_plugin_timedate_plugin_description_example_time { + get { + return ResourceManager.GetString("Microsoft_plugin_timedate_plugin_description_example_time", resourceCulture); + } + } + /// /// Looks up a localized string similar to Time and Date. /// diff --git a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Properties/Resources.resx b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Properties/Resources.resx index bf22dcdd6f..d9555e12c6 100644 --- a/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Properties/Resources.resx +++ b/src/modules/launcher/Plugins/Microsoft.PowerToys.Run.Plugin.TimeDate/Properties/Resources.resx @@ -198,8 +198,17 @@ 'UTC' means here 'Universal Time Convention' - Provides time and date values for the system time or a custom time stamp (Examples: 'day', 'day::{0}', 'time::{1}', 'calendar week::{0}') - The character sequence '::' is a fixed delimiter in plugin code. Do not translate the placeholders '{0}' and '{1}' because it will be replaced in code. + Provides time and date values for the system time or a custom time stamp (Examples: '{0}', '{1}', '{2}', '{3}') + Do not translate the placeholders like '{0}' because it will be replaced in code. + + + Calendar week + + + Day + + + Time Time and Date