Create a plugin with a i18ln title

Answered

Hi,

I'm devolping a plugin for Intellij and this plugin start hidden in the bottom bar (only shows the plugin title/id and icon). 

How can i show this title/id in a multi-language when is hidden? 

 

Thanks!

10 comments
Comment actions Permalink

What do you mean by 'plugin title' and 'the bottom bar'? Could you please attach a screenshot?

0
Comment actions Permalink


When the Intellij loads the plugins is hidden like this

 

So here we have the icon and the tiltle defined in the plugin.xml 

<toolWindow id="CheckTool" anchor="bottom"


I want this translated. I know I can change and change the text to a translated text in the ToolWindowFactory using toolWindow.setTitle and toolWindow.setStripeTitle, but this will only be executed after opening the plugin (press that "CheckTool").

0
Comment actions Permalink

You can override ToolWindowFactory#init and set title there.

By the way you're mixing up 'tool window' and 'plugin' concepts. 'Tool Window' is just an additional component shown in the IDE main screen, but a plugin is the whole bunch of functionality provided by your code. A plugin may show several tool windows or don't show tool windows at all. Note that you need to provide a tool window only if it shows some information which users may want to see simultaneously with editing their sources. If you want to provide a way to invoke some tool, you may add an action to the main menu which shows a dialog allowing a user to setup parameter and invoke the tool when user clicks ok. This way you'll save space on the main screen, users will be able to invoke the tool via shortcut by assigning it to the action, etc.

1
Comment actions Permalink

This plugin opens a toolwindow with a table. That's why I'm using an extensionPoint with a toolwindow.

 

Can you give me an example of how can I override that? I cannot find the init method to override!

 

Thank you for the help!

0
Comment actions Permalink

Thank you Nikolay.

 

Now I understand, but the problem is I'm still on Intellij 2015. Is there a way to do this for this version?

 

Regards

0
Comment actions Permalink

You can register an ApplicationComponent and write in its initComponent's implementation (which is called when IDE starts) code which calls ToolWindowManager#getToolWindow method to get instance ToolWindow and calls setTitle on it.

0
Comment actions Permalink

I did try that but ToolWindowManager#getInstance needs the Project and by that time I don't have any open projects. So how can I get the ToolWindowManager?

0
Comment actions Permalink

I found the solution for this. 

 

Instead of using the ApplicationComponent, I used the ProjectComponent and in the startup I'm creating the toolwindow myself (instead of having the Extension point creating)

0
Comment actions Permalink

Yes, you're right, ProjectComponent should help here.

0

Please sign in to leave a comment.