How do I localize the text on the plug-in toolbar and switch the display language during operation? Follow
I'm developing a plug-in.I want to dynamically switch the text content displayed in the action during runtime, such as switching between Chinese and English. I currently do not know how to manipulate the text of the corresponding action, and I cannot obtain the corresponding action object.
Thanks a lot.
Please sign in to leave a comment.
Use ResourceBundles and localize texts there for all languages you want to support https://plugins.jetbrains.com/docs/intellij/basic-action-system.html#localizing-actions-and-groups
I mean implementing dynamic modifications without restarting the IDE.ResourceBundles seem to take effect when the IDE starts loading plug-ins. Should this not enable dynamic changes during IDE runtime?
How and why would you change the language of the IDE at runtime?
I want to modify the text displayed by the action on the toolbar in my plugin. It's not about modifying the language of the entire IDE. I just want to provide a separate feature for switching display languages for my plugin, and the corresponding text can be switched in real-time. The function of language switching is separate from the overall settings of the IDE and completely independent. But I found that using ResourceBundles does not seem to achieve dynamic modification of action text at runtime.
Sorry for delay. I still don't understand the use case for switching dynamically without restarting the IDE. Anyway, I'm not aware of any mechanism that would allow this to be built easily.
Thank you for your answer. It seems to me that it's unreasonable, it's just a request from others, and I'm just trying it. Finally, thank you again for your patient reply.