I’m having issues with i18n in my JIRA plugin. Not sure if it’s me or JIRA causing the problem.
My setup:
- Properties file:
rootcause
in net/mycompany/rootcauseanalysis
- In
atlassian-plugin.xml
:
<resource type="i18n" name="i18n" location="net.mycompany.rootcauseanalysis.rootcause"/>
customPlugin.title=My Cool Plugin
- In Java class (extends
JiraWebActionSupport
):
String displayName = getText("customPlugin.title");
When I print displayName
, I get customPlugin.title
instead of My Cool Plugin
.
I’ve tried:
- Changing folder structure
- Renaming files and properties
- Using different quotes
Any ideas what I’m doing wrong? I’m out of options here!
Hey there, I feel your pain with JIRA plugin internationalization. Been there, done that, got the t-shirt!
One thing that’s bitten me before is the file encoding. Make sure your properties file is saved in UTF-8 format. I once spent hours debugging only to realize my file was in ISO-8859-1.
Also, have you tried using the fully qualified name in your getText() call? Sometimes that can make a difference. So instead of getText(“customPlugin.title”), try getText(“net.mycompany.rootcauseanalysis.rootcause.customPlugin.title”).
If that doesn’t work, you might want to check if there’s any caching going on. I’ve had issues where changes weren’t reflected until I cleared Tomcat’s work directory and restarted JIRA.
Lastly, make sure your plugin is actually being loaded. Check JIRA’s logs for any warnings or errors related to your plugin during startup. Sometimes JIRA silently fails to load plugins and it’s not immediately obvious.
Hope this helps! Let us know if you figure it out.
yo, had similar headaches. try this:
double-check ur properties file name matches exactly whats in atlassian-plugin.xml
make sure ur not accidentally overriding getText() somewhere
try using gettext(“rootcause.customPlugin.title”) instead
if none work, maybe post ur full plugin.xml? could be smthin weird there. gl mate!
I’ve encountered similar i18n issues in JIRA plugins before. One thing to check is if your properties file is being picked up correctly by the classloader. Try moving it to the ‘resources’ folder in your project structure if it’s not there already.
Another potential issue could be the package declaration in your Java class. Ensure it matches the path you’ve specified in the atlassian-plugin.xml file. Sometimes a mismatch here can cause the resource bundle not to be found.
Lastly, double-check that you’re building and deploying the plugin correctly. Sometimes old files can persist in the build, causing unexpected behavior. A clean build and redeploy might solve the issue.
If none of these work, you might want to enable debug logging for the i18n components to get more insight into what’s happening behind the scenes.