Skip to content

Use Flow.Launcher.Localization to improve code quality #3765

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 42 commits into from
Jul 26, 2025

Conversation

Jack251970
Copy link
Member

@Jack251970 Jack251970 commented Jun 23, 2025

CHANGES

  • Use Flow.Launcher.Localization to improve code quality so that we can remove some useless project reference.
  • Remove LocalizationConverter.cs & EnumBindingSource.cs
  • And some other minor improvement.

TEST

  • Calculator setting panel & Bookmark custom browser window & Explorer settings panel can work as origin.

@Jack251970 Jack251970 self-assigned this Jun 23, 2025
@Jack251970 Jack251970 added this to the 2.0.0 milestone Jun 23, 2025
@Jack251970 Jack251970 requested a review from Copilot June 23, 2025 05:06
Copy link

gitstream-cm bot commented Jun 23, 2025

🥷 Code experts: jjw24

Jack251970 has most 👩‍💻 activity in the files.
Jack251970, jjw24 have most 🧠 knowledge in the files.

See details

Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

Activity based on git-commit:

Jack251970
JUN 71 additions & 97 deletions
MAY 11 additions & 1 deletions
APR 81 additions & 92 deletions
MAR 17 additions & 7 deletions
FEB
JAN

Knowledge based on git-blame:
Jack251970: 40%

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/BookmarkLoader.cs

Activity based on git-commit:

Jack251970
JUN
MAY
APR 2 additions & 3 deletions
MAR
FEB
JAN

Knowledge based on git-blame:
jjw24: 19%
Jack251970: 4%

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs

Activity based on git-commit:

Jack251970
JUN 258 additions & 198 deletions
MAY
APR 55 additions & 60 deletions
MAR 32 additions & 12 deletions
FEB
JAN

Knowledge based on git-blame:
Jack251970: 58%
jjw24: 4%

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj

Activity based on git-commit:

Jack251970
JUN 35 additions & 34 deletions
MAY
APR 2 additions & 2 deletions
MAR 35 additions & 35 deletions
FEB
JAN

Knowledge based on git-blame:
jjw24: 36%
Jack251970: 34%

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Helper/FaviconHelper.cs

Activity based on git-commit:

Jack251970
JUN 76 additions & 0 deletions
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
Jack251970: 100%

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs

Activity based on git-commit:

Jack251970
JUN 6 additions & 6 deletions
MAY 3 additions & 2 deletions
APR 17 additions & 17 deletions
MAR 17 additions & 18 deletions
FEB
JAN

Knowledge based on git-blame:
Jack251970: 14%
jjw24: 10%

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/CustomBrowser.cs

Activity based on git-commit:

Jack251970
JUN
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml

Activity based on git-commit:

Jack251970
JUN
MAY
APR 18 additions & 18 deletions
MAR
FEB
JAN

Knowledge based on git-blame:
Jack251970: 9%

Plugins/Flow.Launcher.Plugin.Calculator/DecimalSeparator.cs

Activity based on git-commit:

Jack251970
JUN
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
jjw24: 72%

Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj

Activity based on git-commit:

Jack251970
JUN
MAY
APR
MAR
FEB 2 additions & 1 deletions
JAN

Knowledge based on git-blame:
jjw24: 19%
Jack251970: 1%

Plugins/Flow.Launcher.Plugin.Calculator/Main.cs

Activity based on git-commit:

Jack251970
JUN
MAY
APR
MAR 8 additions & 8 deletions
FEB
JAN

Knowledge based on git-blame:
jjw24: 33%
Jack251970: 4%

Plugins/Flow.Launcher.Plugin.Calculator/ViewModels/SettingsViewModel.cs

Activity based on git-commit:

Jack251970
JUN
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
jjw24: 65%

Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml

Activity based on git-commit:

Jack251970
JUN
MAY
APR
MAR
FEB 11 additions & 9 deletions
JAN

Knowledge based on git-blame:
jjw24: 25%
Jack251970: 10%

Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml.cs

Activity based on git-commit:

Jack251970
JUN
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
jjw24: 94%

Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj

Activity based on git-commit:

Jack251970
JUN
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
jjw24: 15%
Jack251970: 11%

Plugins/Flow.Launcher.Plugin.Program/Main.cs

Activity based on git-commit:

Jack251970
JUN
MAY
APR 187 additions & 139 deletions
MAR
FEB 96 additions & 14 deletions
JAN 60 additions & 8 deletions

Knowledge based on git-blame:
Jack251970: 59%
jjw24: 6%

To learn more about /:\ gitStream - Visit our Docs

@coderabbitai coderabbitai bot added the enhancement New feature or request label Jun 23, 2025
Copy link

gitstream-cm bot commented Jun 23, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

1 similar comment
Copy link

gitstream-cm bot commented Jun 23, 2025

Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX.

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR replaces custom localization and enum-binding implementations with the Flow.Launcher.Localization package, removes obsolete converters and project references, and updates XAML and code to use the new Localize API.

  • Swap out LocalizationConverter and EnumBindingSource for Flow.Launcher.Localization attributes and helpers
  • Remove unnecessary project references and add package references (MemoryPack, NLog, Flow.Launcher.Localization)
  • Update all enum bindings in XAML and translation calls in code to use Display/Value and the Localize static class

Reviewed Changes

Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Plugins/Flow.Launcher.Plugin.Program/Main.cs Compute cache directory via parent folders and move cache files
Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj Remove Infrastructure reference; add MemoryPack and NLog
Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml.cs Change constructor to accept Settings and instantiate VM
Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml Replace enum-binding resource with AllDecimalSeparator binding
Plugins/Flow.Launcher.Plugin.Calculator/ViewModels/SettingsViewModel.cs Introduce AllDecimalSeparator list and SelectedDecimalSeparator property
Plugins/Flow.Launcher.Plugin.Calculator/Main.cs Rename constants, switch to Localize calls, make some methods static
Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj Remove Core reference; add Flow.Launcher.Localization
Plugins/Flow.Launcher.Plugin.Calculator/DecimalSeparator.cs Replace TypeConverter attributes with EnumLocalize attrs
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml Update enum binding to AllBrowserTypes with Display/Value
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/CustomBrowser.cs Implement OnPropertyChanged; add AllBrowserTypes list
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs Replace _context field with Context property; use Localize
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Helper/FaviconHelper.cs Update logging calls to use Context
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj Remove Infrastructure reference; add Flow.Launcher.Localization
Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs Use Context instead of _context for logging and stopwatch
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/BookmarkLoader.cs Use Context for FuzzySearch
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs Use Context for logging and stopwatch
Flow.Launcher.Infrastructure/UI/EnumBindingSource.cs Remove obsolete enum-binding extension
Flow.Launcher.Core/Resource/LocalizationConverter.cs Remove obsolete localization converter

Copy link
Contributor

coderabbitai bot commented Jun 23, 2025

📝 Walkthrough

"""

Walkthrough

This set of changes removes obsolete localization and enum binding infrastructure, replacing it with a new localization package. Plugins are updated to use new localization attributes and context access patterns. XAML bindings are refactored to use view model-driven collections for localized display. Project files are updated to reference the new localization package, and code is refactored for consistency and maintainability.

Changes

Files/Groups Change Summary
Flow.Launcher.Core/Resource/LocalizationConverter.cs
Flow.Launcher.Infrastructure/UI/EnumBindingSource.cs
Deleted obsolete localization and enum binding classes, removing LocalizationConverter and EnumBindingSourceExtension.
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs
Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Helper/FaviconHelper.cs
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/BookmarkLoader.cs
Replaced all references to Main._context with Main.Context for API access and logging. No logic or control flow changes.
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs Changed static context field to a property (Context), updated all references, and switched localization calls to use the new Localize class.
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/CustomBrowser.cs Added property for all localized browser types, updated property setters to avoid redundant notifications, and annotated BrowserType enum for localization.
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml Refactored ComboBox binding from enum-based to collection-based using AllBrowserTypes for localized display. Removed obsolete namespace references.
Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj Removed reference to Flow.Launcher.Infrastructure, added package reference to Flow.Launcher.Localization v0.0.4.
Plugins/Flow.Launcher.Plugin.Calculator/DecimalSeparator.cs Replaced old localization attributes with new EnumLocalize attributes, updated using directives.
Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj Removed project reference to Flow.Launcher.Core, added package reference to Flow.Launcher.Localization v0.0.4.
Plugins/Flow.Launcher.Plugin.Calculator/Main.cs Refactored localization to use Localize class, made context static, renamed constants, removed SettingsViewModel static usage, updated static method signatures, and improved code style. Added OnCultureInfoChanged method for culture updates.
Plugins/Flow.Launcher.Plugin.Calculator/ViewModels/SettingsViewModel.cs Added static property for max decimal places range, added properties for all localized decimal separators and selected separator with change notification.
Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml Changed ComboBox binding from enum-based with converter to collection-based using AllDecimalSeparator, updated design-time data context, and removed obsolete resources and event handlers. Corrected spelling of resource keys.
Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml.cs Changed constructor to accept Settings and instantiate SettingsViewModel internally. Removed unused loaded event handler.
Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj Removed reference to Flow.Launcher.Infrastructure, added package references to MemoryPack and NLog.
Plugins/Flow.Launcher.Plugin.Program/Main.cs Replaced usage of static cache directory with dynamically derived cache directory relative to plugin context.
Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj Updated package reference to Flow.Launcher.Localization v0.0.4.
Plugins/Flow.Launcher.Plugin.Explorer/Helper/SortOptionTranslationHelper.cs Deleted obsolete static helper class that translated sort option enums into localized strings.
Plugins/Flow.Launcher.Plugin.Explorer/Languages/en.xaml Expanded localization entries for Everything plugin sort options to include explicit ascending and descending variants with arrows.
Plugins/Flow.Launcher.Plugin.Explorer/Main.cs Removed assignment of API context to SortOptionTranslationHelper. Added OnCultureInfoChanged method to update localized labels. Changed contextMenu type from interface to concrete class.
Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingAPI.cs Changed method parameter and conditional variable types from SortOption to new EverythingSortOption enum for type consistency.
Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingApiDllImport.cs Updated DllImport method signatures to use EverythingSortOption instead of SortOption.
Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSearchOption.cs Changed parameter type from SortOption to EverythingSortOption, removed unused using directive.
Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingSortOption.cs Added new localized enum EverythingSortOption defining sorting options for Everything plugin with localization keys.
Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/SortOption.cs Deleted old SortOption enum replaced by EverythingSortOption.
Plugins/Flow.Launcher.Plugin.Explorer/Settings.cs Changed SortOption property type to EverythingSortOption, removed obsolete array property of sort options.
Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/SettingsViewModel.cs Added properties for all localized Everything sort options and selected option, replaced translation calls with Localize static methods for warning messages.
Plugins/Flow.Launcher.Plugin.Explorer/Views/Converters/EverythingEnumNameConverter.cs Deleted obsolete enum name converter class used for localized display in UI.
Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml Refactored ComboBox binding for Everything sort options from enum-based with converter to collection-based with SelectedValue and DisplayMemberPath, removed converter resource and event handler, changed warning bindings to OneWay.
Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml.cs Removed event handler method for Everything sort option change that updated warning UI.
Plugins/Flow.Launcher.Plugin.Explorer/ContextMenu.cs Removed SettingsViewModel parameter from constructor, removed calls to ViewModel.Save(), relying on direct API save calls.
.github/actions/spelling/allow.txt Added "favicons" and "moz" to spelling allowlist.
.github/actions/spelling/patterns.txt Added regex pattern to match non-English words with accented characters and a pattern to match repeated "Settings Settings" phrase.
Plugins/Flow.Launcher.Plugin.Calculator/MainRegexHelper.cs Added internal static partial class with compiled regexes for expression validation and bracket matching.
Plugins/Flow.Launcher.Plugin.Calculator/Languages/*.xaml (multiple files) Corrected spelling of localization keys from "seperator" to "separator" for decimal separator related keys across multiple language resource files.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Plugin
    participant Localize
    participant ViewModel

    User->>Plugin: Open settings panel
    Plugin->>ViewModel: Instantiate (with settings)
    ViewModel->>Localize: Get localized enum values (e.g., DecimalSeparatorLocalized.GetValues())
    Localize-->>ViewModel: Return list of localized values
    ViewModel-->>Plugin: Provide AllDecimalSeparator/AllBrowserTypes collection
    Plugin->>User: Display ComboBox with localized values
    User->>Plugin: Select value
    Plugin->>ViewModel: Update SelectedValue property
    ViewModel->>Plugin: Notify property changed (if value changed)
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~45 minutes

Possibly related PRs

Suggested reviewers

  • jjw24
  • taooceros
    """

Note

⚡️ Unit Test Generation is now available in beta!

Learn more here, or try it out under "Finishing Touches" below.

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch code_quality

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
Plugins/Flow.Launcher.Plugin.Program/Main.cs (1)

243-248: Consider defensive programming for cache file operations.

The cache file migration logic looks correct, but consider adding validation to ensure the derived cache directory path is valid before attempting file operations.

The file move operations correctly use the dynamically derived cache directory. You might consider logging when cache files are successfully migrated for better observability:

                 MoveFile(oldWin32CacheFile, newWin32CacheFile);
+                if (!File.Exists(oldWin32CacheFile) && File.Exists(newWin32CacheFile))
+                    Context.API.LogInfo(ClassName, "Successfully migrated Win32 cache file");
                 var oldUWPCacheFile = Path.Combine(cacheDirectory, $"{UwpCacheName}.cache");
                 var newUWPCacheFile = Path.Combine(pluginCacheDirectory, $"{UwpCacheName}.cache");
                 MoveFile(oldUWPCacheFile, newUWPCacheFile);
+                if (!File.Exists(oldUWPCacheFile) && File.Exists(newUWPCacheFile))
+                    Context.API.LogInfo(ClassName, "Successfully migrated UWP cache file");
Plugins/Flow.Launcher.Plugin.Calculator/Main.cs (1)

29-29: Consider initialization safety for static Context.

The static Context property with null! default could lead to null reference exceptions if accessed before initialization. Consider adding a validation check or using a different initialization pattern.

-internal static PluginInitContext Context { get; set; } = null!;
+internal static PluginInitContext Context { get; set; } = null!;

Alternatively, consider adding a property that throws a descriptive exception if accessed before initialization:

+private static PluginInitContext? _context;
+internal static PluginInitContext Context
+{
+    get => _context ?? throw new InvalidOperationException("Plugin not initialized");
+    set => _context = value;
+}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 40e5c04 and 9be2ef0.

📒 Files selected for processing (18)
  • Flow.Launcher.Core/Resource/LocalizationConverter.cs (0 hunks)
  • Flow.Launcher.Infrastructure/UI/EnumBindingSource.cs (0 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (4 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/BookmarkLoader.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs (5 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj (1 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Helper/FaviconHelper.cs (4 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs (7 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/CustomBrowser.cs (3 hunks)
  • Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Calculator/DecimalSeparator.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Calculator/Main.cs (6 hunks)
  • Plugins/Flow.Launcher.Plugin.Calculator/ViewModels/SettingsViewModel.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml (2 hunks)
  • Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml.cs (2 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Program/Main.cs (1 hunks)
💤 Files with no reviewable changes (2)
  • Flow.Launcher.Core/Resource/LocalizationConverter.cs
  • Flow.Launcher.Infrastructure/UI/EnumBindingSource.cs
🧰 Additional context used
🪛 GitHub Check: Check Spelling
Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs

[warning] 61-61:
favicons is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (26)
Plugins/Flow.Launcher.Plugin.Program/Flow.Launcher.Plugin.Program.csproj (1)

66-66: Verify package versions for security and currency.

The added package references use specific versions that may not be the latest. Please ensure these versions are secure and up-to-date.

What are the latest stable versions of MemoryPack and NLog NuGet packages, and are there any known security vulnerabilities in versions 1.21.4 and 4.7.10 respectively?

Also applies to: 72-72

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Flow.Launcher.Plugin.BrowserBookmark.csproj (1)

98-98: Ensure localization package version consistency

Confirm that Flow.Launcher.Localization version 0.0.3 is used uniformly across all plugin projects to prevent version conflicts.

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Helper/FaviconHelper.cs (1)

30-32: Consistent context usage in logging calls

All exception logging now correctly uses Main.Context.API.LogException instead of the old _context field, aligning with the new static property. No issues detected.

Also applies to: 42-43, 52-53, 64-65

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Commands/BookmarkLoader.cs (1)

12-12: Context property used for fuzzy search

The calls to Main.Context.API.FuzzySearch have been updated correctly for both bookmark name and URL. Functionality remains intact.

Also applies to: 16-16

Plugins/Flow.Launcher.Plugin.Calculator/Flow.Launcher.Plugin.Calculator.csproj (1)

65-65: Add Localization package dependency

The new reference to Flow.Launcher.Localization v0.0.3 matches the refactor goal. Verify alignment with other plugins to maintain consistency.

Plugins/Flow.Launcher.Plugin.BrowserBookmark/FirefoxBookmarkLoader.cs (1)

52-53: Update context references consistently

All instances of Main._context have been replaced with Main.Context, including exception logging and stopwatch logging calls. This change is consistent with the refactoring plan and introduces no functional regressions.

Also applies to: 87-90, 101-102, 114-115, 189-190

Plugins/Flow.Launcher.Plugin.BrowserBookmark/ChromiumBookmarkLoader.cs (1)

48-48: LGTM! Consistent refactoring from static field to property.

The changes consistently update all API access points from Main._context.API to Main.Context.API, which aligns with the broader refactor in the plugin. The functionality remains unchanged while improving code organization.

Also applies to: 61-61, 128-128, 193-193

Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml.cs (1)

15-21: LGTM! Good encapsulation improvement.

The constructor change improves encapsulation by accepting the raw Settings object and handling SettingsViewModel instantiation internally. This simplifies the interface for callers and gives the view control over its own ViewModel creation.

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Views/CustomBrowserSetting.xaml (1)

144-147: LGTM! Modernized ComboBox binding approach.

The change from enum binding source to collection-based binding with DisplayMemberPath and SelectedValuePath is a good improvement. This approach provides better localization support and follows MVVM best practices.

Plugins/Flow.Launcher.Plugin.BrowserBookmark/Main.cs (3)

22-22: LGTM! Context field to property refactor.

The change from static field _context to static property Context improves encapsulation and provides a cleaner API. The usage is consistently updated throughout the file.

Also applies to: 32-32, 45-45


87-87: LGTM! Consistent Context.API usage.

All API access points have been consistently updated to use the new Context property, maintaining the same functionality while aligning with the refactored architecture.

Also applies to: 111-111, 220-220, 227-227, 229-229


195-195: LGTM! Localization refactor to static methods.

The transition from Context.API.GetTranslation to Localize static methods aligns perfectly with the PR objectives of adopting Flow.Launcher.Localization to improve code quality. This approach provides better type safety and consistency.

Also applies to: 200-200, 214-215

Plugins/Flow.Launcher.Plugin.Calculator/Views/CalculatorSettings.xaml (2)

9-9: LGTM! Improved design-time experience.

Adding the design-time DataContext for SettingsViewModel will improve the development experience by providing IntelliSense and design-time data binding in the XAML designer.


40-43: LGTM! Modernized ComboBox binding pattern.

The change from enum binding source to view model collection binding follows MVVM best practices and aligns with the new localization approach. Using DisplayMemberPath and SelectedValuePath provides better flexibility and localization support.

Plugins/Flow.Launcher.Plugin.Calculator/DecimalSeparator.cs (2)

1-16: LGTM! Clean migration to new localization system.

The migration from the old LocalizationConverter approach to the new EnumLocalize attributes is well-implemented:

  • Proper use of [EnumLocalize] on the enum
  • Correct [EnumLocalizeKey] attributes with nameof() for compile-time safety
  • Clean removal of obsolete dependencies

8-8: ```shell
#!/bin/bash

1. Search .resx files for the full localization keys (typo and correct spelling)

echo "Searching for 'flowlauncher_plugin_calculator_decimal_seperator' in .resx:"
rg -i "flowlauncher_plugin_calculator_decimal_seperator" -g '*.resx'

echo -e "\nSearching for 'flowlauncher_plugin_calculator_decimal_separator' in .resx:"
rg -i "flowlauncher_plugin_calculator_decimal_separator" -g '*.resx'

2. Check if any alias or using directive maps a Resources class to Localize

echo -e "\nSearching for 'using .*Localize' in the plugin code:"
rg -n "using .*Localize" -t cs

echo -e "\nSearching for assignment alias 'Localize =' in the code:"
rg -n "Localize *= *" -t cs

3. Show the top of DecimalSeparator.cs to see namespace/imports

echo -e "\nHeader of DecimalSeparator.cs:"
sed -n '1,30p' Plugins/Flow.Launcher.Plugin.Calculator/DecimalSeparator.cs


</details>
<details>
<summary>Plugins/Flow.Launcher.Plugin.BrowserBookmark/Models/CustomBrowser.cs (3)</summary>

`54-62`: **LGTM! Proper enum localization implementation.**

The `BrowserType` enum correctly uses the new localization attributes:
- `[EnumLocalize]` on the enum declaration
- `[EnumLocalizeValue]` with string literals for each member

This provides proper localization support for the browser type selection.

---

`38-38`: **LGTM! Clean approach for UI binding.**

The `AllBrowserTypes` property provides a localized collection that can be easily bound to UI controls, replacing the need for enum-based XAML bindings. This aligns well with the removal of `EnumBindingSource`.

---

`17-35`: **LGTM! Improved property change notification.**

The property setters now properly implement change detection before firing `OnPropertyChanged()`, which prevents unnecessary notifications and improves performance.

</details>
<details>
<summary>Plugins/Flow.Launcher.Plugin.Calculator/ViewModels/SettingsViewModel.cs (3)</summary>

`18-18`: **LGTM! Clean collection initialization for UI binding.**

The `AllDecimalSeparator` property provides a localized collection that replaces the need for enum-based XAML binding, consistent with the new localization approach.

---

`20-31`: **LGTM! Proper two-way data binding implementation.**

The `SelectedDecimalSeparator` property correctly implements:
- Direct access to the underlying Settings property
- Change detection before notification
- Proper `OnPropertyChanged()` call for UI updates

This enables clean two-way binding in the UI.

---

`11-11`: **LGTM! Proper localization initialization.**

The call to `DecimalSeparatorLocalized.UpdateLabels(AllDecimalSeparator)` ensures the localized labels are updated at initialization time, which is necessary for proper display.

</details>
<details>
<summary>Plugins/Flow.Launcher.Plugin.Calculator/Main.cs (4)</summary>

`26-27`: **LGTM! Cleaner constant definitions.**

The decimal separator constants are now more readable and consistent with their usage throughout the class.

---

`141-184`: **LGTM! Good refactoring to static methods.**

Converting these utility methods to static is appropriate since they don't depend on instance state. The `ChangeDecimalSeparator` method also has improved null safety.

---

`198-198`: **LGTM! Simplified settings panel creation.**

Passing the `Settings` object directly to the constructor is cleaner and aligns with the updated `CalculatorSettings` constructor signature.

---

`72-76`: ```shell
#!/bin/bash
# Search for any Localize class definitions in the C# sources
echo "Searching for Localize class definitions:"
rg "class Localize" -n .

# Look for the auto‐generated designer file that may contain the Localize class
echo -e "\nLooking for Localize.Designer.cs:"
fd Localize.Designer.cs

# List all .resx files to locate where the resources are defined
echo -e "\nListing all .resx files:"
find . -type f -name "*.resx"

# Search .resx files for the specific resource names
echo -e "\nSearching .resx for ‘flowlauncher_plugin_calculator_not_a_number’:"
grep -Rn "<data name=\"flowlauncher_plugin_calculator_not_a_number\"" --include="*.resx"

echo -e "\nSearching .resx for ‘flowlauncher_plugin_calculator_expression_not_complete’:"
grep -Rn "<data name=\"flowlauncher_plugin_calculator_expression_not_complete\"" --include="*.resx"

@Jack251970
Copy link
Member Author

Jack251970 commented Jun 23, 2025

@jjw24 I found analyzers cannot work with CI build here?!!

I can confirm the build of Calculator project works fine for me with Visual Studio.

image

@Jack251970 Jack251970 removed the enhancement New feature or request label Jun 23, 2025
@jjw24
Copy link
Member

jjw24 commented Jun 23, 2025

@jjw24 I found analyzers cannot work with CI build here?!!

I can confirm the build of Calculator project works fine for me with Visual Studio. image

Hm, not sure what's going without researching myself.

@jjw24
Copy link
Member

jjw24 commented Jun 23, 2025

Actually are you missing the project reference? That's the usual error with this.

Edit: nvm I see it's already added.

@Jack251970
Copy link
Member Author

As you can see, GitHub Action also works well here... It seems to be the problem related to AppVeyor

@coderabbitai coderabbitai bot added the enhancement New feature or request label Jul 14, 2025
@VictoriousRaptor
Copy link
Contributor

@Jack251970 LGTM. Please review.

return;
Settings.SortOption = value;
OnPropertyChanged(nameof(SelectedEverythingSortOption));
OnPropertyChanged(nameof(FastSortWarningVisibility));
Copy link
Contributor

@VictoriousRaptor VictoriousRaptor Jul 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we should update them in on language change too?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we should update them in on language change too?

No, I do not think so because when we are editing something in setting panel, the language will not change which means for translations that are get in SettingViewModel will be refreshed during setting panel construction. So we only need to update the AllEverythingSortOptions translations which cache translations in SettingViewModel instance.

@VictoriousRaptor VictoriousRaptor self-requested a review July 22, 2025 16:14
@VictoriousRaptor
Copy link
Contributor

let's merge it before the decimal pr

@Jack251970
Copy link
Member Author

let's merge it before the decimal pr

Oh, I am unable to do that😢

AppVeyor CI fails to build with Flow.Launcher.Localization package

@VictoriousRaptor
Copy link
Contributor

let's merge it before the decimal pr

Oh, I am unable to do that😢

AppVeyor CI fails to build with Flow.Launcher.Localization package

CSC : warning CS9057: The analyzer assembly 'C:\Users\appveyor\.nuget\packages\flow.launcher.localization\0.0.3\analyzers\dotnet\cs\Flow.Launcher.Localization.Analyzers.dll' references version '4.13.0.0' of the compiler, which is newer than the currently running version '4.12.0.0'.

Do you have this warning on your Visual studio?

@Jack251970
Copy link
Member Author

warning CS9057:

Nope

@VictoriousRaptor
Copy link
Contributor

warning CS9057:

Nope

Could you try to change the required analyzer version of Flow.Launcher.Localization to 4.12.0?

@Jack251970
Copy link
Member Author

warning CS9057:

Nope

Could you try to change the required analyzer version of Flow.Launcher.Localization to 4.12.0?

how can I do that?

@VictoriousRaptor VictoriousRaptor merged commit c42628b into dev Jul 26, 2025
6 checks passed
@VictoriousRaptor VictoriousRaptor deleted the code_quality branch July 26, 2025 16:37
TBM13 added a commit to TBM13/Flow.Launcher that referenced this pull request Aug 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
10 min review bug Something isn't working Code Quality enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants