views:

202

answers:

2

In my helpset file, I'm declaring a favorites view, using

<view>
  <name>Lesezeichen</name>
  <label>Lesezeichen</label>
  <type>javax.help.FavoritesView</type>
  <data></data>
</view>

This automatically adds an appropriate button to the toolbar (in the swing application). Unfortunately, the tooltip of the button reads "Add to favorites". I would like to replace this by my own text, but didn't find anything about this in the documentation or using a google search. Any ideas or pointers?

Disclaimer: I already posted this question to JavaRanch, didn't get an answer yet, though.

+1  A: 

If you extract the src.jar (rename it to src.zip and extract) and open the java class jh2.0/src/src/javax/help/resources/Constants.java you will notice that in the section

// Tooltips for Actions

is located entry for localization:

{ "tooltip.FavoritesAction", "Add to Favorites"},

This constant is missing from the jh2.0/src/src/javax/help/resources/Constants_de.java which is used in your case. Just add the right translation, compile the source or just this class and add it to the jh.jar (you may treat the jar as a simple zip archive)

Yes, I know this is dirty hack, but generally JavaHelp is quite useful

Boris Pavlović
A: 

Now this sounds weird. The ResourceBundle mechanism supports to "override" the class resource content by using a .properties file with the resource bundle. Try placing the looked up resource bundle as a properties file in the respective folder denoted by the bundle name. E.g. if HelpUtilities looks after javax.help.resources.Constants by calling

ResourceBundle.getBundle("javax.help.resources.Constants", locale);

you'd be placing your file in a folder structure at /javax/help/resources/Constants_de_DE.properties. This must be located in your applications "working directory".