How do I localize the text on the plug-in toolbar and switch the display language during operation?

Answered

Dear all,

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.

6 comments
Comment actions Permalink

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

0
Comment actions Permalink

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?

0
Comment actions Permalink

How and why would you change the language of the IDE at runtime?

0
Comment actions Permalink

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.

0
Comment actions Permalink

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.

0
Comment actions Permalink

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.

0

Please sign in to leave a comment.