Commit graph

58 commits

Author SHA1 Message Date
copilot-swe-agent[bot]
649b142b46 Add UseThousandsSeparator setting to Calculator plugin
Co-authored-by: Jack251970 <53996452+Jack251970@users.noreply.github.com>
2026-01-10 06:30:57 +00:00
Jack Ye
5b6ea73513
Code cleanup & Use Flow.Launcher.Localization to improve code quality (#4009)
* Use Flow.Launcher.Localization to improve code quality

* Code cleanup

* Improve code quality

* Improve code quality

* Use internal static Context & Improve code quality

* Use Flow.Launcher.Localization to improve code quality

* Code cleanup

* Use Flow.Launcher.Localization to improve code quality

* Improve code quality

* Improve code quality

* Use Flow.Launcher.Localization to improve code quality

* Fix logic issue

* Fix the variable name typo

* Fix redundant boolean cast and ensure consistent default value handling

* Use Flow.Launcher.Localization to improve code quality

* Revert namespace styles

* Fix indent format

* Revert namespace style

* Fix indent format

* Fix namespace style

* Fix indent format

* Fix indent format
2025-09-27 19:18:33 +03:00
Jack251970
e10b9254ed Add workaround for log & ln function 2025-09-16 16:31:06 +08:00
Jack251970
6841ad5410 Add calculator unit testing 2025-09-16 16:08:17 +08:00
Jack251970
f9facda521 Improve code quality 2025-09-15 13:02:42 +08:00
Jack251970
1906d68541 Add ShowErrorMessage setting 2025-09-15 12:57:25 +08:00
Jack251970
cea1402dde Improve code quality 2025-09-15 12:53:17 +08:00
Jack251970
b07420a193 Use EmptyResults to improve code quality 2025-09-15 12:51:31 +08:00
dcog989
9be8b71f09 review feedback, CultureInvariant, mild refactor 2025-09-14 22:28:37 +01:00
dcog989
edc76faeb4 Review feedback, case insensitive, consistent separators 2025-09-14 21:51:47 +01:00
dcog989
e990e0ff5b Handle misplaced separators, Mages edge cases
Allow for e.g. `25,00` when `,` used as digit grouping.
Exclude Mages function from the above relaxed logic.
2025-09-14 19:39:06 +01:00
dcog989
336e51d104 IcoPath to const string 2025-09-14 17:08:37 +01:00
Jack251970
daf35a4972 Do not check bracket complete 2025-09-14 15:54:35 +08:00
Jack251970
11f5ea5074 Improve code quality 2025-09-14 12:33:46 +08:00
dcog989
110f571b40 Rework solution for nested Mages
Previous solution missed e.g. `pow(min(2,3), 4)`
2025-09-13 13:17:08 +01:00
dcog989
190e0e179f Fix 'German' number formatting 2025-09-12 20:01:55 +01:00
dcog989
103d3832a0 dead code, improve messages, group separator fix? 2025-09-12 19:30:07 +01:00
dcog989
e1079396c3 backout 'smart' digit grouping, mages fixes + workaround
Mages did not like the previous change to smart thousands / decimal so backed that out.

Workaround for https://github.com/FlorianRappl/Mages/issues/132
2025-09-12 19:20:19 +01:00
Jack Ye
80c0920f10
Merge branch 'dev' into fix-typo 2025-07-28 02:56:32 +01:00
VictoriousRaptor
53255c3a9c Fix typo 2025-07-27 18:41:23 +08:00
VictoriousRaptor
443d4f7c02 Build regex at compile time 2025-07-27 18:39:38 +08:00
VictoriousRaptor
71e0374640 Merge dev 2025-07-27 14:45:08 +08:00
dcog989
f8a6b02c80 fix for GitHub build server failure
Removes external dependency for NumberGroupSeparator so it builds anywhere.
2025-07-24 02:33:59 +01:00
dcog989
76f834ff1b PR review changes 2025-07-23 17:56:58 +01:00
dcog989
852b2f517b fix for regression from first review, plus issues with e.g. '0,123' and ',123' 2025-07-23 04:27:19 +01:00
dcog989
c83a29fb18 PR review changes 2025-07-23 01:18:26 +01:00
dcog989
113baac567 Smart thousands and decimals
## Core Logic

*   **Advanced Number Parsing:** We now process numbers with various decimal and thousand-separator formats (e.g., `1,234.56` and `1.234,56`). We distinguish between separator types based on their position and surrounding digits.
*   **Context-Aware Output Formatting:** We now mirror the output format based on the user's input. If a query includes thousand separators, the result will also have them. The decimal separator in the result will match the one used in the query.

## Code Cleanup

*   **Deleted Unused File:** `NumberTranslator.cs` was unused and therefore removed.
*   **Removed Redundant UI Code:** The `CalculatorSettings_Loaded` event handler in `CalculatorSettings.xaml.cs` (and its XAML registration) was removed. The functionality was already handled automatically by data binding.

## Maintainability

*   **Added Code Documentation:** An XML summary comment was added to the new `NormalizeNumber` method in `Main.cs` to clarify its purpose.

So, the plugin is now much more flexible, and will accept whatever format the user gives it regardless of Windows region settings.
2025-07-22 23:48:11 +01:00
VictoriousRaptor
282581940a Use new Localization package 2025-07-23 00:04:52 +08:00
VictoriousRaptor
6579a4647d Compile regex on build time 2025-07-22 23:59:33 +08:00
VictoriousRaptor
22ffc80aeb Update labels on language change and other refactor
- Bring back viewmodel construction on init
- Remove redundant init code
2025-07-22 23:48:39 +08:00
Jack Ye
ed0524d207
Merge branch 'dev' into code_quality 2025-07-20 20:02:51 +08:00
Jack251970
b9418f1272 Add translations 2025-07-20 11:33:12 +08:00
Jack Ye
fc6ff5a7a0
Merge branch 'dev' into code_quality 2025-07-14 09:09:09 +08:00
TBM13
d68964bfa2 Calculator: Support hex numbers 2025-06-26 02:58:24 -03:00
Jack251970
fe7985d564 Use Flow.Launcher.Localization to improve code quality 2025-06-23 12:25:16 +08:00
Jack251970
13fcdc60fa Fix typo 'seperator' 2025-03-20 18:11:53 +08:00
Jack251970
534a1117aa Use public api to call ShowMsgBox functions & remove useless Core project import 2024-11-27 12:21:34 +08:00
Jack251970
b30cc4fc38 Replace System.Windows.MessageBox with MessageBoxEx 2024-11-25 10:38:43 +08:00
VictoriousRaptor
e4621a5c87 Fix calculator typo 2024-05-25 14:35:14 +08:00
VictoriousRaptor
fa2df93dd7 Fix calculator decimal separator bug 2024-05-25 14:10:29 +08:00
NoPlagiarism
1020320412 [Calculator] Add comparison operators & remainder 2024-01-18 01:13:38 +05:00
NoPlagiarism
c3cf3d9e7e [Calculator] Allow more functions to be used 2024-01-11 15:27:35 +05:00
Jeremy Wu
1ff328be03 update copy calls to use API CopyToClipboard method 2023-06-08 22:46:37 +10:00
Vic
30987f9c95 Use DefaultThreadCurrentCulture for culture in app domain 2022-11-25 12:11:24 +08:00
Jeremy Wu
1dfada9243
Update README.md 2022-09-28 08:19:41 +10:00
Oren Nachman
a3197f8ee1 Fix (some) build warnings
CS1572
CS1573
CS0168
CS8073
CA2200
VSTHRD110
VSTHRD200
VSTHRD105
SYSLIB0013
CS8524
2022-08-07 21:31:38 -07:00
Jeremy
b177f6d67f add decimal separator check to CanCalculate 2022-04-24 19:33:06 +10:00
Hongtao Zhang
4b09e07e09 Use decimal separator in setting for query 2022-03-31 13:53:07 -05:00
张弘韬
d84eff7712 Remove unneccessary api, rename storage api, and update comment 2021-05-13 19:29:21 +08:00
张弘韬
358460cb22 Move storage to api call for websearch and calculator plugins 2021-05-12 19:38:29 +08:00