在Java帮助中更改“收藏夹”工具提示

时间:2023-01-13 12:26:17

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

在我的helpset文件中,我正在声明一个收藏夹视图,使用

<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?

这会自动将相应的按钮添加到工具栏(在swing应用程序中)。不幸的是,按钮的工具提示显示“添加到收藏夹”。我想用我自己的文本替换它,但在文档中或使用谷歌搜索没有找到任何相关内容。任何想法或指针?

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

免责声明:我已将此问题发布到JavaRanch,但尚未得到答案。

2 个解决方案

#1


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

如果您解压缩src.jar(将其重命名为src.zip并解压缩)并打开java类jh2.0 / src / src / javax / help / resources / Constants.java,您会注意到该部分

// 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)

在您的情况下使用的jh2.0 / src / src / javax / help / resources / Constants_de.java中缺少此常量。只需添加正确的翻译,编译源代码或只是这个类并将其添加到jh.jar(您可以将jar视为一个简单的zip存档)

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

是的,我知道这是脏黑客,但一般来说JavaHelp非常有用

#2


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机制支持通过将.properties文件与资源包一起“覆盖”类资源内容。尝试将查找的资源包作为属性文件放在包名称所表示的相应文件夹中。例如。如果HelpUtilities通过调用来查看javax.help.resources.Constants

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".

您将文件放在/javax/help/resources/Constants_de_DE.properties的文件夹结构中。它必须位于应用程序“工作目录”中。

#1


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

如果您解压缩src.jar(将其重命名为src.zip并解压缩)并打开java类jh2.0 / src / src / javax / help / resources / Constants.java,您会注意到该部分

// 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)

在您的情况下使用的jh2.0 / src / src / javax / help / resources / Constants_de.java中缺少此常量。只需添加正确的翻译,编译源代码或只是这个类并将其添加到jh.jar(您可以将jar视为一个简单的zip存档)

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

是的,我知道这是脏黑客,但一般来说JavaHelp非常有用

#2


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机制支持通过将.properties文件与资源包一起“覆盖”类资源内容。尝试将查找的资源包作为属性文件放在包名称所表示的相应文件夹中。例如。如果HelpUtilities通过调用来查看javax.help.resources.Constants

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".

您将文件放在/javax/help/resources/Constants_de_DE.properties的文件夹结构中。它必须位于应用程序“工作目录”中。