Skip to content

Remove TranslationConverter & project reference in Explorer plugin #3595

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

Open
wants to merge 2 commits into
base: dev
Choose a base branch
from

Conversation

Jack251970
Copy link
Member

Since we have used DI for api instance, there is no need to keep translation converter.

Also removed all project references in Explorer project.

We should keep Droplex NuGet package since it is used in Explorer plugin for Everything download.

This comment has been minimized.

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 removes the old TranslationConverter class and project references from the Explorer plugin, replacing XAML bindings with a new LocalizedDescription property that uses DI for translations, and updates package references to include Droplex.

  • Replace TranslationConverter usage in XAML with direct LocalizedDescription bindings
  • Add LocalizedDescription properties in ViewModel and settings models to call GetTranslation via DI
  • Remove project references to Core/Infrastructure in Explorer plugin and add Droplex NuGet package

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml Removed converter namespace and replaced binding with LocalizedDescription
Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs Added LocalizedDescription property using Main.Context.API
Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj Removed Core/Infrastructure project refs, added Droplex package
Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml Switched from TranslationConverter binding to LocalizedDescription
Flow.Launcher/Resources/SettingWindowStyle.xaml Removed TranslationConverter resource entry
Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs Added LocalizedDescription with static DI resolution
Flow.Launcher.Core/Resource/TranslationConverter.cs Deleted obsolete converter class
Comments suppressed due to low confidence (3)

Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs:61

  • [nitpick] Private static fields should follow naming conventions (e.g. _api or s_api) to improve readability and maintain consistency with the codebase style.
private static IPublicAPI api = null;

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs:27

  • Instead of calling the API via Main.Context, consider injecting IPublicAPI into your ViewModel (e.g. via constructor) to follow DI patterns consistently and improve testability.
public string LocalizedDescription => Main.Context.API.GetTranslation(Description);

Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs:58

  • [nitpick] The LocalizedDescription logic is duplicated in multiple models; consider extracting a shared base class or helper method to reduce duplication and centralize translation logic.
public string LocalizedDescription => API.GetTranslation(Description);

Copy link

gitstream-cm bot commented May 30, 2025

🥷 Code experts: onesounds

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

See details

Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY 54 additions & 13 deletions
APR
MAR
FEB
JAN

Knowledge based on git-blame:
Jack251970: 51%

Flow.Launcher/Resources/SettingWindowStyle.xaml

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame:
onesounds: 100%

Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY 4 additions & 1 deletions
APR
MAR 14 additions & 28 deletions
FEB
JAN

Knowledge based on git-blame:
onesounds: 11%
Jack251970: 3%

Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj

Activity based on git-commit:

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

Knowledge based on git-blame:
Jack251970: 5%

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs

Activity based on git-commit:

Jack251970 onesounds
JUN
MAY
APR 5 additions & 3 deletions
MAR
FEB
JAN

Knowledge based on git-blame:
Jack251970: 8%

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

Activity based on git-commit:

Jack251970 onesounds
JUN 659 additions & 658 deletions 747 additions & 725 deletions
MAY
APR 5 additions & 5 deletions
MAR 2066 additions & 1972 deletions 1 additions & 1 deletions
FEB
JAN

Knowledge based on git-blame:
Jack251970: 77%
onesounds: 21%

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

Copy link

gitstream-cm bot commented May 30, 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 May 30, 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

coderabbitai bot commented May 30, 2025

📝 Walkthrough

Walkthrough

This change removes the TranslationConverter class and its usage throughout the codebase, replacing it with new LocalizedDescription properties in relevant models. XAML bindings are updated to use these properties directly, and dependency injection is leveraged for translation access. Project references are also updated in the Explorer plugin.

Changes

Files/Paths Change Summary
Flow.Launcher.Core/Resource/TranslationConverter.cs Deleted the TranslationConverter class implementing IValueConverter for translation.
Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs Added LocalizedDescription property to BaseBuiltinShortcutModel using DI for translation.
Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs Added LocalizedDescription property to ActionKeywordModel for localized descriptions.
Flow.Launcher/Resources/SettingWindowStyle.xaml
Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
Removed TranslationConverter resource and its usage from XAML; updated bindings to use new property.
Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml Changed binding from Description with converter to LocalizedDescription directly.
Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj Added Droplex package, removed references to Core and Infrastructure projects.

Sequence Diagram(s)

sequenceDiagram
    participant View (XAML)
    participant Model
    participant API

    View->>Model: Bind to LocalizedDescription
    Model->>API: GetTranslation(Description)
    API-->>Model: Localized string
    Model-->>View: LocalizedDescription value
Loading

Suggested labels

kind/i18n

Suggested reviewers

  • jjw24
  • taooceros

Poem

A hop, a skip, translation’s new,
No more converters in the view!
Models now with words so bright,
Localized with pure delight.
XAML’s bindings, clean and neat,
Explorer’s code is light and sweet.
🐇✨


📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 4a50eec and a02a236.

📒 Files selected for processing (2)
  • Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml
🚧 Files skipped from review as they are similar to previous changes (1)
  • Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: gitStream workflow automation
  • GitHub Check: gitStream.cm
  • GitHub Check: build
  • GitHub Check: Check Spelling

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 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

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 6144d4a and 4a50eec.

📒 Files selected for processing (7)
  • Flow.Launcher.Core/Resource/TranslationConverter.cs (0 hunks)
  • Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs (2 hunks)
  • Flow.Launcher/Resources/SettingWindowStyle.xaml (0 hunks)
  • Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs (1 hunks)
  • Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml (2 hunks)
💤 Files with no reviewable changes (2)
  • Flow.Launcher/Resources/SettingWindowStyle.xaml
  • Flow.Launcher.Core/Resource/TranslationConverter.cs
🧰 Additional context used
🧬 Code Graph Analysis (1)
Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs (2)
Flow.Launcher/PublicAPIInstance.cs (1)
  • GetTranslation (240-240)
Flow.Launcher.Plugin/Interfaces/IPublicAPI.cs (1)
  • GetTranslation (141-141)
🪛 GitHub Actions: Check Spelling
Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml

[warning] 489-489: Spell check warning: previewpanel is not a recognized word. (unrecognized-spelling)


[warning] 496-496: Spell check warning: previewpanel is not a recognized word. (unrecognized-spelling)


[warning] 500-500: Spell check warning: previewpanel is not a recognized word. (unrecognized-spelling)


[warning] 504-504: Spell check warning: previewpanel is not a recognized word. (unrecognized-spelling)


[warning] 717-717: Spell check warning: lbx is not a recognized word. (unrecognized-spelling)


[warning] 774-774: Spell check warning: lbx is not a recognized word. (unrecognized-spelling)


[warning] 777-777: Spell check warning: lbx is not a recognized word. (unrecognized-spelling)


[warning] 778-778: Spell check warning: Lbx is not a recognized word. (unrecognized-spelling)

⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: gitStream workflow automation
  • GitHub Check: gitStream.cm
  • GitHub Check: gitStream.cm
  • GitHub Check: build
🔇 Additional comments (6)
Flow.Launcher/SettingPages/Views/SettingsPaneHotkey.xaml (1)

427-427: LGTM! Clean refactoring from converter to property-based localization.

The change from using TranslationConverter to directly binding to LocalizedDescription aligns perfectly with the PR objectives to remove the converter and use dependency injection. This simplifies the XAML binding and centralizes localization logic in the model.

Plugins/Flow.Launcher.Plugin.Explorer/ViewModels/ActionKeywordModel.cs (1)

27-27:

❓ Verification inconclusive

Verify API availability for localization.

The LocalizedDescription property implementation looks good and aligns with the refactoring goals. However, ensure that Main.Context.API is properly initialized before this property is accessed to avoid potential null reference exceptions.

Run the following script to verify that Main.Context.API is properly initialized:


🏁 Script executed:

#!/bin/bash
# Description: Check how Main.Context.API is initialized and used
# Expected: Find proper initialization and null checks where appropriate

# Search for Main.Context.API usage patterns
rg -A 3 -B 3 "Main\.Context\.API" --type cs

# Search for Main.Context initialization
rg -A 5 "Main\.Context\s*=" --type cs

Length of output: 21601


Verify initialization of Main.Context.API

The LocalizedDescription implementation is correct, but I wasn’t able to locate where Main.Context (and its API property) is assigned before use. Please confirm that Main.Context.API is initialized in your plugin’s startup (e.g., in the Main class constructor or Program.cs) so that accessing LocalizedDescription at runtime cannot produce a null reference.

  • Locate the assignment of Main.Context (and its API field/property) in the plugin initialization code.
  • Ensure that Context.API is non-null before any UI bindings or view-models access LocalizedDescription.
Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj (1)

49-49:

✅ Verification successful

Verify Droplex package version and security.

The addition of Droplex v1.7.0 aligns with the PR objectives to retain this package for downloading Everything. Please verify this is the latest stable version and check for any security advisories.


🌐 Web query:

What is the latest version of the Droplex NuGet package and are there any known security vulnerabilities?

💡 Result:

Latest Version of Droplex NuGet Package

The latest version of the Droplex NuGet package is 1.7.0, which was released on August 3, 2023. This version targets .NET Core 3.1 and is compatible with that framework or higher[1][2].

Known Security Vulnerabilities

There are no publicly reported security vulnerabilities associated with the Droplex package version 1.7.0 on major sources like NuGet or its GitHub repository as of the current date[1][2].

Key points on vulnerability checking:

  • NuGet and tools like dotnet list package --vulnerable pull vulnerability data primarily from sources like the GitHub Advisory Database, covering reported vulnerabilities[6][9].
  • If a vulnerability exists, it usually shows up as a warning in Visual Studio or via the .NET CLI, and there is currently no such notice for Droplex 1.7.0[1][2].
  • No security advisories or warnings for Droplex appear in available vulnerability management and advisory resources[1][2][9].
  • Keep in mind that an absence of reported vulnerabilities does not guarantee there are none, only that none have been documented in the main public databases.

Summary Table

Package Latest Version Release Date Known Vulnerabilities
Droplex 1.7.0 2023-08-03 None reported

Recommendation:
To stay secure, always monitor for new advisories by regularly updating your packages, reviewing upstream security feeds, and using automated tools for vulnerability scanning[6][9].

If you’re using Droplex in a sensitive or production environment, routinely check for updates or notices from its maintainers and repositories.

Citations:


Droplex package version and security verified

Droplex v1.7.0 (released Aug 3, 2023) is the latest stable version and has no publicly reported vulnerabilities. You can safely proceed with this dependency.

• File: Plugins/Flow.Launcher.Plugin.Explorer/Flow.Launcher.Plugin.Explorer.csproj (line 49)

Plugins/Flow.Launcher.Plugin.Explorer/Views/ExplorerSettings.xaml (2)

111-111: LGTM! Consistent refactoring to property-based localization.

The change from using Description with TranslationConverter to directly binding to LocalizedDescription is consistent with the refactoring approach used throughout the codebase. This simplifies the binding and eliminates the need for the converter.


506-506: Good cleanup of unnecessary whitespace.

Minor but good cleanup removing the empty line for better code formatting.

Flow.Launcher.Infrastructure/UserSettings/CustomShortcutModel.cs (1)

4-5: LGTM: Appropriate dependencies for the new localization approach.

The added using statements correctly support the dependency injection pattern for accessing the translation API.

@Jack251970 Jack251970 modified the milestones: Future, 1.20.1 May 31, 2025
Copy link

github-actions bot commented Jun 6, 2025

@check-spelling-bot Report

🔴 Please review

See the 📂 files view, the 📜action log, or 📝 job summary for details.

❌ Errors and Warnings Count
❌ forbidden-pattern 22
⚠️ non-alpha-in-dictionary 13

See ❌ Event descriptions for more information.

If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant