-
-
Notifications
You must be signed in to change notification settings - Fork 365
Fix Language Change Issue #3376
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
Conversation
@check-spelling-bot Report🔴 Please reviewSee the 📂 files view, the 📜action log, or 📝 job summary for details.
See ❌ Event descriptions for more information. If the flagged items are 🤯 false positivesIf items relate to a ...
|
Be a legend 🏆 by adding a before and after screenshot of the changes you made, especially if they are around UI/UX. |
📝 WalkthroughWalkthroughThe pull request modifies the internationalization workflow. In the Changes
Sequence Diagram(s)sequenceDiagram
participant App as App.xaml.cs
participant Intl as Internationalization
participant PM as PluginManager
App->>Intl: InitializeLanguageAsync()
Intl->>PM: GetPluginsForInterface<IPluginI18n>()
PM-->>Intl: Return plugin list
Intl->>Intl: AddPluginLanguageDirectories()
Intl->>Intl: ChangeLanguageAsync(Language)
Note right of Intl: Save language setting & update culture
Intl->>Intl: UpdatePluginMetadataTranslations() (async)
Intl-->>App: Language initialization complete
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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)
Flow.Launcher/App.xaml.cs (1)
138-142
: Consider handling exceptions fromInitializeLanguageAsync
Using an
await
call for the asynchronous language initialization is appropriate. However, since this initialization occurs during startup, consider wrapping it in a try/catch or logging any exceptions to avoid silent failures ifInitializeLanguageAsync
encounters issues (e.g., file IO failures, plugin errors).Flow.Launcher.Core/Resource/Internationalization.cs (1)
70-72
: Ensure plugin enumeration is only done when neededCalling
PluginManager.GetPluginsForInterface<IPluginI18n>()
each time adds overhead if invoked repeatedly. Since this method is no longer parameter-based, ensure it is only called once or at appropriate intervals to avoid performance issues.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
Flow.Launcher.Core/Plugin/PluginManager.cs
(0 hunks)Flow.Launcher.Core/Resource/Internationalization.cs
(4 hunks)Flow.Launcher/App.xaml.cs
(1 hunks)
💤 Files with no reviewable changes (1)
- Flow.Launcher.Core/Plugin/PluginManager.cs
🧰 Additional context used
🧬 Code Definitions (2)
Flow.Launcher/App.xaml.cs (1)
Flow.Launcher.Core/Resource/Internationalization.cs (2)
Internationalization
(18-304)Internationalization
(29-34)
Flow.Launcher.Core/Resource/Internationalization.cs (1)
Flow.Launcher.Core/Plugin/PluginManager.cs (8)
PluginManager
(24-617)PluginManager
(139-145)Task
(87-95)Task
(97-104)Task
(106-113)Task
(115-122)Task
(164-221)Task
(238-280)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: gitStream.cm
- GitHub Check: gitStream.cm
- GitHub Check: gitStream.cm
- GitHub Check: gitStream.cm
🔇 Additional comments (2)
Flow.Launcher.Core/Resource/Internationalization.cs (2)
99-120
: Asynchronous initialization looks solidThe newly introduced
InitializeLanguageAsync
method cleanly handles fallback to system language, adds plugin language directories, and changes the language. This separation of concerns enhances maintainability and clarity.
162-164
: Check thread-safety ofUpdatePluginMetadataTranslations
await Task.Run(UpdatePluginMetadataTranslations);
executes plugin metadata updates on a thread pool thread. Ensure that no UI-bound objects are accessed, and that plugin data structures are thread-safe. Otherwise, consider using the UI thread or synchronization strategies.Also applies to: 177-177
🥷 Code experts: no user but you matched threshold 10 Jack251970 has most 👩💻 activity in the files. See details
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame:
Activity based on git-commit:
Knowledge based on git-blame: To learn more about /:\ gitStream - Visit our Docs |
This PR contains a TODO statement. Please check to see if they should be removed. |
Follow on with #3365.
Improve Language Initialization
Originally, we use
ChangeLanguage
to initialize language & change language, which I think is a little bit unclear.Now I add
InitializeLanguage
for initializing language and I removeChangeLanguage
inPluginManager
because we only need to call it once.Fix Language Initialization Issue
This function should be called after plugins are initialized because we will call
GetTranslatedTitle
function to update plugin metadata and many plugins useContext.API
to get its translated titles and descriptions, so we would better to callInitAsync
before calling this function.