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

Fix WinForm Culture Info Issue

Open Jack251970 opened this issue 6 months ago • 6 comments

Fix WinForm Culture Info Issue

For WinForm localization, we need to set culture info before creating application so that WinForm can follow the set language. This is helpful for plugins with WinForm windows.

To implement this, we also need to initialize settings so that we can get language code and initialize system language before changing culture info.

Test

  • Install one plugin with WinForm windows and change the application language to one language different from system language. Open the WinForm windows and check localization.

Jack251970 avatar May 21 '25 06:05 Jack251970

🥷 Code experts: VictoriousRaptor

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

See details

Flow.Launcher.Core/Resource/Internationalization.cs

Activity based on git-commit:

Jack251970
JUN
MAY
APR 34 additions & 30 deletions
MAR 67 additions & 40 deletions
FEB 5 additions & 4 deletions
JAN 81 additions & 42 deletions

Knowledge based on git-blame: Jack251970: 38% VictoriousRaptor: 3%

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Activity based on git-commit:

Jack251970
JUN 3 additions & 2 deletions
MAY 73 additions & 28 deletions
APR 34 additions & 83 deletions
MAR 142 additions & 94 deletions
FEB 10 additions & 4 deletions
JAN 17 additions & 4 deletions

Knowledge based on git-blame: Jack251970: 30% VictoriousRaptor: 13%

Flow.Launcher/App.xaml.cs

Activity based on git-commit:

Jack251970
JUN 2 additions & 0 deletions
MAY 13 additions & 4 deletions
APR 73 additions & 40 deletions
MAR 168 additions & 94 deletions
FEB 79 additions & 40 deletions
JAN 86 additions & 66 deletions

Knowledge based on git-blame: Jack251970: 68%

Flow.Launcher/Helper/WindowsMediaPlayerHelper.cs

Activity based on git-commit:

Jack251970
JUN
MAY
APR
MAR
FEB
JAN

Knowledge based on git-blame: VictoriousRaptor: 100%

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

gitstream-cm[bot] avatar May 21 '25 06:05 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 May 21 '25 06:05 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 and Warnings Count
:x: forbidden-pattern 22
: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 May 21 '25 06:05 github-actions[bot]

[!WARNING]

Rate limit exceeded

@Jack251970 has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 4 minutes and 55 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between b0997449c17117214a246c537b2472db5fb88596 and 9e24d2cb9191df33fafee41284a27dd4dfb14874.

📒 Files selected for processing (3)
  • Flow.Launcher.Infrastructure/UserSettings/Settings.cs (2 hunks)
  • Flow.Launcher/App.xaml.cs (4 hunks)
  • Flow.Launcher/Helper/WindowsMediaPlayerHelper.cs (1 hunks)
📝 Walkthrough

"""

Walkthrough

The changes refactor language code and culture initialization, moving system language setup and culture info application to explicit static methods. Application settings loading and error handling are shifted from the constructor to the static Main method, ensuring localization is configured before app instantiation. Font resource assignment is updated with null checks for safety.

Changes

File(s) Change Summary
Flow.Launcher.Core/Resource/Internationalization.cs Refactored system language code initialization to a static method; made language code field static; added a static method to centralize culture info changes, ensuring consistent culture updates for both main and current threads.
Flow.Launcher.Infrastructure/UserSettings/Settings.cs Enhanced font resource assignment after DI initialization; added null checks before updating application font resources to prevent null reference exceptions.
Flow.Launcher/App.xaml.cs Moved settings loading and error handling from constructor to static Main; made settings field static; centralized error handling in a static method; ensured culture setup before app instantiation.

Sequence Diagram(s)

sequenceDiagram
    participant Main as Main()
    participant Settings as Settings
    participant Intl as Internationalization
    participant App as App()

    Main->>Settings: Load()
    alt On error
        Main->>Main: Show error message and terminate
    end
    Main->>Intl: InitSystemLanguageCode()
    Main->>Intl: ChangeCultureInfo(Settings.Language)
    Main->>App: Create App instance
    App->>Settings: Use already loaded settings

Possibly related PRs

  • Flow-Launcher/Flow.Launcher#3376: Refactors asynchronous language initialization and plugin language directory management in the Internationalization class, directly related to language and culture setup changes.
  • Flow-Launcher/Flow.Launcher#3161: Adds system language option and related logic in Internationalization, complementing the refactoring of system language code handling.

Suggested labels

Dev branch only

Suggested reviewers

  • Jack251970
  • onesounds

Poem

In the warren of code, a new flow is born,
With culture and language now statically sworn.
Settings awake before dawn’s first light,
Fonts checked for nulls, all handled just right.
A hop, a leap—localization in sight!
🐇✨ """

✨ Finishing Touches
  • [ ] 📝 Generate Docstrings

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.

coderabbitai[bot] avatar May 21 '25 06:05 coderabbitai[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 and Warnings Count
:x: forbidden-pattern 22
: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 May 21 '25 06:05 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 and Warnings Count
:x: forbidden-pattern 22
: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 03 '25 06: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 and Warnings Count
:x: forbidden-pattern 22
: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 '25 13: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 and Warnings Count
:x: forbidden-pattern 22
: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 '25 13: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 and Warnings Count
:x: forbidden-pattern 22
: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 '25 13: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 and Warnings Count
:x: forbidden-pattern 22
: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 '25 13:06 github-actions[bot]