Plugin UI text

From VuzeWiki
Jump to: navigation, search

Here's how to add internationalized text to your UI, and replace !something! type labels with normal ones.

  1. Have a plugin written and know how to package it into a .jar, etc.
  2. Create a Messages.properties file with all the strings your UI uses. The file would look something like this:
    yourplugin.name=Name of Your Plugin
    yourplugin.buttontext=Text on a button
    yourplugin.some.other.string=Other String that I'm using
    
    Put the Messages.properties file in the same directory as your source code.
  3. Use the strings in your code. For example:
    LocaleUtilities lu = pluginInterface.getUtilities().getLocaleUtilities();
    
    lu.integrateLocalisedMessageBundle("org.gudy.azureus2.pluginsimpl.webpeer.Messages"); //This is important!
    
    BasicPluginConfigModel config = pluginInterface.getUIManager().createBasicPluginConfigModel( "plugins", "yourplugin.name");
    
    button = config.addActionParameter2("yourplugin.some.other.string","yourplugin.buttontext");