[cmdpal] Port v1 calculator extension (#38629)

* init

* update

* Remove duplicated cp command

* Change the long desc

* Update notice.md

* Use the same icon for fallback item

* Add Rappl to expect list

* update notice.md

* Move the original order back.

* Make Radians become default choice

* Fix empty result

* Remove unused settings.
Move history back.
Refactory the query logic

* fix typo

* merge main

* CmdPal: minor calc updates (#38914)

A bunch of calc updates

* maintain the visibility of the history
* add other formats to the context menu #38708
* some other icon tidying

---------

Co-authored-by: Yu Leng (from Dev Box) <yuleng@microsoft.com>
Co-authored-by: Mike Griese <migrie@microsoft.com>
This commit is contained in:
Yu Leng
2025-04-17 14:59:10 +08:00
committed by GitHub
parent 4f9e829155
commit 6cf73ce839
19 changed files with 1565 additions and 154 deletions

View File

@@ -60,6 +60,24 @@ namespace Microsoft.CmdPal.Ext.Calc.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Failed to calculate the input.
/// </summary>
public static string calculator_calculation_failed_title {
get {
return ResourceManager.GetString("calculator_calculation_failed_title", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copy binary.
/// </summary>
public static string calculator_copy_binary {
get {
return ResourceManager.GetString("calculator_copy_binary", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Copy.
/// </summary>
@@ -69,6 +87,15 @@ namespace Microsoft.CmdPal.Ext.Calc.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Copy hexadecimal.
/// </summary>
public static string calculator_copy_hex {
get {
return ResourceManager.GetString("calculator_copy_hex", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Calculator.
/// </summary>
@@ -78,6 +105,24 @@ namespace Microsoft.CmdPal.Ext.Calc.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Expression contains division by zero.
/// </summary>
public static string calculator_division_by_zero {
get {
return ResourceManager.GetString("calculator_division_by_zero", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Unsupported use of square brackets.
/// </summary>
public static string calculator_double_array_returned {
get {
return ResourceManager.GetString("calculator_double_array_returned", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Error: {0}.
/// </summary>
@@ -87,6 +132,33 @@ namespace Microsoft.CmdPal.Ext.Calc.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Expression wrong or incomplete.
/// </summary>
public static string calculator_expression_not_complete {
get {
return ResourceManager.GetString("calculator_expression_not_complete", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Calculation result is not a valid number (NaN).
/// </summary>
public static string calculator_not_a_number {
get {
return ResourceManager.GetString("calculator_not_a_number", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Result value was either too large or too small for a decimal number.
/// </summary>
public static string calculator_not_covert_to_decimal {
get {
return ResourceManager.GetString("calculator_not_covert_to_decimal", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Type an equation....
/// </summary>
@@ -105,6 +177,105 @@ namespace Microsoft.CmdPal.Ext.Calc.Properties {
}
}
/// <summary>
/// Looks up a localized string similar to Use English (United States) number format for input.
/// </summary>
public static string calculator_settings_in_en_format {
get {
return ResourceManager.GetString("calculator_settings_in_en_format", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Ignores your system setting and expects numbers in the format &apos;{0}&apos;..
/// </summary>
public static string calculator_settings_in_en_format_description {
get {
return ResourceManager.GetString("calculator_settings_in_en_format_description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Use English (United States) number format for output.
/// </summary>
public static string calculator_settings_out_en_format {
get {
return ResourceManager.GetString("calculator_settings_out_en_format", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Ignores your system setting and returns numbers in the format &apos;{0}&apos;..
/// </summary>
public static string calculator_settings_out_en_format_description {
get {
return ResourceManager.GetString("calculator_settings_out_en_format_description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Replace input if query ends with &apos;=&apos;.
/// </summary>
public static string calculator_settings_replace_input {
get {
return ResourceManager.GetString("calculator_settings_replace_input", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to When using direct activation, appending &apos;=&apos; to the expression will replace the input with the calculated result (e.g. &apos;=5*3-2=&apos; will change the query to &apos;=13&apos;)..
/// </summary>
public static string calculator_settings_replace_input_description {
get {
return ResourceManager.GetString("calculator_settings_replace_input_description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Degrees.
/// </summary>
public static string calculator_settings_trig_unit_degrees {
get {
return ResourceManager.GetString("calculator_settings_trig_unit_degrees", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Gradians.
/// </summary>
public static string calculator_settings_trig_unit_gradians {
get {
return ResourceManager.GetString("calculator_settings_trig_unit_gradians", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Trigonometry Unit.
/// </summary>
public static string calculator_settings_trig_unit_mode {
get {
return ResourceManager.GetString("calculator_settings_trig_unit_mode", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Specifies the angle unit to use for trigonometry operations.
/// </summary>
public static string calculator_settings_trig_unit_mode_description {
get {
return ResourceManager.GetString("calculator_settings_trig_unit_mode_description", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Radians.
/// </summary>
public static string calculator_settings_trig_unit_radians {
get {
return ResourceManager.GetString("calculator_settings_trig_unit_radians", resourceCulture);
}
}
/// <summary>
/// Looks up a localized string similar to Calculator.
/// </summary>

View File

@@ -140,4 +140,63 @@
<data name="calculator_copy_command_name" xml:space="preserve">
<value>Copy</value>
</data>
<data name="calculator_calculation_failed_title" xml:space="preserve">
<value>Failed to calculate the input</value>
</data>
<data name="calculator_division_by_zero" xml:space="preserve">
<value>Expression contains division by zero</value>
</data>
<data name="calculator_expression_not_complete" xml:space="preserve">
<value>Expression wrong or incomplete</value>
</data>
<data name="calculator_not_a_number" xml:space="preserve">
<value>Calculation result is not a valid number (NaN)</value>
</data>
<data name="calculator_double_array_returned" xml:space="preserve">
<value>Unsupported use of square brackets</value>
</data>
<data name="calculator_settings_trig_unit_gradians" xml:space="preserve">
<value>Gradians</value>
</data>
<data name="calculator_settings_trig_unit_degrees" xml:space="preserve">
<value>Degrees</value>
</data>
<data name="calculator_settings_trig_unit_radians" xml:space="preserve">
<value>Radians</value>
</data>
<data name="calculator_settings_trig_unit_mode" xml:space="preserve">
<value>Trigonometry Unit</value>
</data>
<data name="calculator_settings_trig_unit_mode_description" xml:space="preserve">
<value>Specifies the angle unit to use for trigonometry operations</value>
</data>
<data name="calculator_settings_out_en_format" xml:space="preserve">
<value>Use English (United States) number format for output</value>
</data>
<data name="calculator_settings_out_en_format_description" xml:space="preserve">
<value>Ignores your system setting and returns numbers in the format '{0}'.</value>
<comment>{0} is a placeholder and will be replaced in code.</comment>
</data>
<data name="calculator_settings_in_en_format" xml:space="preserve">
<value>Use English (United States) number format for input</value>
</data>
<data name="calculator_settings_in_en_format_description" xml:space="preserve">
<value>Ignores your system setting and expects numbers in the format '{0}'.</value>
<comment>{0} is a placeholder and will be replaced in code.</comment>
</data>
<data name="calculator_settings_replace_input" xml:space="preserve">
<value>Replace input if query ends with '='</value>
</data>
<data name="calculator_settings_replace_input_description" xml:space="preserve">
<value>When using direct activation, appending '=' to the expression will replace the input with the calculated result (e.g. '=5*3-2=' will change the query to '=13').</value>
</data>
<data name="calculator_not_covert_to_decimal" xml:space="preserve">
<value>Result value was either too large or too small for a decimal number</value>
</data>
<data name="calculator_copy_hex" xml:space="preserve">
<value>Copy hexadecimal</value>
</data>
<data name="calculator_copy_binary" xml:space="preserve">
<value>Copy binary</value>
</data>
</root>