Flow.Launcher icon indicating copy to clipboard operation
Flow.Launcher copied to clipboard

Localize startup messages about missing Python/NodeJS

Open Yusyuriv opened this issue 1 year ago • 12 comments

Fixes #1292, closes PR #1392.

Issue

On startup, Flow was waiting until plugins are loaded before loading any localization files. If there are Python/Node plugins installed without the Python/Node runtime specified in settings, it would show a hard-coded message in English (and a few other hard-coded messages).

Changes

What I did:

  1. Moved internationalization initialization higher, above loading plugins
  2. Extracted the hard-coded messages from above into en.xaml
  3. Since now it doesn't wait for plugins to load first, and those directories are now unknown at the time of initialization, removed adding plugins' translation directories from Internationalization constructor
  4. Made PluginManager call AddPluginLanguageDirectories and ChangeLanguage after the plugins have been loaded.

Testing

  • [x] The startup messages are now localized
  • [x] Flow launches and seems to work correctly

Summary by CodeRabbit

  • New Features

    • Enhanced internationalization support with new message prompts and translations for better language consistency.
  • Bug Fixes

    • Improved handling of failed plugin initialization with detailed internationalized error messages.
  • Refactor

    • Refined message prompt constructions and formatting for better readability and maintainability.
    • Reordered settings and language assignments for smoother plugin loading.
  • Localization

    • Added new translation strings for English and Russian language files related to plugin prompts and error messages.

Yusyuriv avatar Jun 09 '24 13:06 Yusyuriv

Moved internationalization initialization higher, above loading plugins

I think internationalization requires loading plugin (for loading plugin resources). Maybe that needs to be changed

taooceros avatar Jun 13 '24 20:06 taooceros

Moved internationalization initialization higher, above loading plugins

I think internationalization requires loading plugin (for loading plugin resources). Maybe that needs to be changed

Yes, which is why I only load Flow's language first (so plugin loading code could display localized errors) and then let PluginManager class add plugins' languages to resources after all plugins have been loaded.

Yusyuriv avatar Jun 16 '24 23:06 Yusyuriv

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors Count
:x: ignored-expect-variant 1
:warning: non-alpha-in-dictionary 13

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: 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.

github-actions[bot] avatar Jun 16 '24 23:06 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors Count
:x: ignored-expect-variant 1
:warning: non-alpha-in-dictionary 13

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: 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.

github-actions[bot] avatar Jun 19 '24 23:06 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors Count
:x: ignored-expect-variant 1
:warning: non-alpha-in-dictionary 13

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: 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.

github-actions[bot] avatar Jun 27 '24 05:06 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors Count
:x: ignored-expect-variant 1
:warning: non-alpha-in-dictionary 13

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: 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.

github-actions[bot] avatar Jun 27 '24 05:06 github-actions[bot]

Walkthrough

The recent updates enhance the internationalization capability of the Flow.Launcher project. Key changes include integrating the InternationalizationManager for better handling of message prompts and translations across the application. This ensures language support and consistency, particularly for plugin installation and error handling messages. Additionally, the Python download dialog is now translatable, expanding the application's accessibility to a broader audience.

Changes

Files Change Summary
Flow.Launcher.Core/ExternalPlugins/Environments/... Refactored to use InternationalizationManager for message formatting and translations.
Flow.Launcher.Core/Plugin/PluginManager.cs Enhanced internationalization, updated initialization process, and improved code readability
Flow.Launcher.Core/Resource/Internationalization.cs Made AddPluginLanguageDirectories method internal and added parameter handling
Flow.Launcher/App.xaml.cs Reordered assignments for better initialization flow and removed temporary fixes
Flow.Launcher/Languages/en.xaml Added new strings for plugin installation prompts and failure messages
Flow.Launcher/Languages/ru.xaml Added translations for new strings related to plugin installation and error messages

Assessment against linked issues

Objective Addressed Explanation
Make Python download dialog translatable (#1292)

Poem

In every plugin, every file, Flow learns a language, mile by mile. 🌐 With words that greet and errors rare, Now speaks the world, with greater care. Translations bloom, and bugs take flight, A coder's dream, a rabbit's delight. 🐇✨


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @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.

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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

coderabbitai[bot] avatar Jun 27 '24 05:06 coderabbitai[bot]

🥷 Code experts: jjw24, VictoriousRaptor

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

See details

Flow.Launcher.Core/ExternalPlugins/Environments/AbstractPluginEnvironment.cs

Activity based on git-commit:

jjw24 VictoriousRaptor
JUN
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame: jjw24: 60%

Flow.Launcher.Core/Plugin/PluginManager.cs

Activity based on git-commit:

jjw24 VictoriousRaptor
JUN
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame: jjw24: 4%

Flow.Launcher.Core/Resource/Internationalization.cs

Activity based on git-commit:

jjw24 VictoriousRaptor
JUN
MAY 3 additions & 6 deletions
APR
MAR
FEB
JAN

Knowledge based on git-blame: jjw24: 10%

Flow.Launcher/App.xaml.cs

Activity based on git-commit:

jjw24 VictoriousRaptor
JUN
MAY 1 additions & 0 deletions
APR
MAR
FEB
JAN

Knowledge based on git-blame: jjw24: 16%

Flow.Launcher/Languages/en.xaml

Activity based on git-commit:

jjw24 VictoriousRaptor
JUN 2 additions & 2 deletions
MAY 4 additions & 3 deletions
APR 6 additions & 6 deletions
MAR
FEB
JAN

Knowledge based on git-blame: jjw24: 7%

Flow.Launcher/Languages/ru.xaml

Activity based on git-commit:

jjw24 VictoriousRaptor
JUN 23 additions & 1 deletions
MAY 49 additions & 9 deletions
APR 2 additions & 0 deletions
MAR
FEB
JAN

Knowledge based on git-blame: jjw24: 98%

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

gitstream-cm[bot] avatar Jun 27 '24 05:06 gitstream-cm[bot]

This PR is 65.93406593406593% new code.

gitstream-cm[bot] avatar Jun 27 '24 05:06 gitstream-cm[bot]

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

gitstream-cm[bot] avatar Jun 27 '24 05:06 gitstream-cm[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors Count
:x: ignored-expect-variant 1
:warning: non-alpha-in-dictionary 13

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: 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.

github-actions[bot] avatar Jun 27 '24 05:06 github-actions[bot]

@check-spelling-bot Report

:red_circle: Please review

See the :open_file_folder: files view, the :scroll:action log, or :memo: job summary for details.

:x: Errors Count
:x: ignored-expect-variant 1
:warning: non-alpha-in-dictionary 13

See :x: Event descriptions for more information.

If the flagged items are :exploding_head: 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.

github-actions[bot] avatar Jun 28 '24 13:06 github-actions[bot]