Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hovering over an NLS message doesn't show the contents if the bundle name isn't constant #553

Open
kjsmita6 opened this issue Apr 28, 2023 · 0 comments

Comments

@kjsmita6
Copy link

Introduction

When creating a message bundle using the "Externalize strings wizard", the java class is initialized with a BUNDLE_NAME variable which contains the fully-qualified name of the message properties file, like:

private static final String BUNDLE_NAME = NlsDemoMsg.class.getPackageName() + ".nlsdemomsg"; //$NON-NLS-1$

In this case, it would resolve to com.example.jdt.nls.msg.nlsdemomsg which indeed resolves to a file called nlsdemomsg.properties in the com.example.jdt.nls.msg package.


Problem

When using any messages from a class created in this way, hovering over the message does not show the contents, and you are not able to quickly goto it in the properties file:
No preview
No goto

I am assuming this is PDE's version of the wizard since it uses org.eclipse.osgi.util.NLS instead of ResourceBundle, but the plain-old Java version does the same thing, using Messages.getString("key") instead. The hover and goto only work if the BUNDLE_NAME is a constant string.


Workaround

If the BUNDLE_NAME is changed to be just the string itself, like

private static final String BUNDLE_NAME = "com.example.jdt.nls.msg.nlsdemomsg"; //$NON-NLS-1$

then those things work:
Preview of the message
Able to goto the file


Expected

Ideally these features would work in all cases, especially as the wizard that makes this file does it the first way by calling getPackageName().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant