ExampleTaskConfigurator - https://bitbucket.org/atlassian/bamboo-sdk-examples/src/ed48459fc04e/part1/myfirstplugin/src/main/java/myfirstplugin/ExampleTaskConfigurator.java#cl-59 uses the textProvider to retrieve i18n values. However, none of the property values are available using this technique. For example, modify the code to always put out error messages - only the literal text gets displayed:
// if (StringUtils.isEmpty(sayValue))
// {
errorCollection.addError("say", "this is error text");
errorCollection.addError("say", textProvider.getText("helloworld.say.error"));
//}
The property file is accessed ok for the UI, just not in the java code.
Community moderators have prevented the ability to post new answers.
Your analysis just turned up in my search regarding the very same issue, thanks! It allowed me to find an alternate workaround by replacing textProvider.getText() with this.getI18nBean() as discovered via peeking into the Bamboo source, where textProvider doesn't seem to be used in several Tasks at least. It's worth noting though, that it is used by other Tasks, e.g. the Ant Task, which still does show validation errors properly, so there seems to be another configuration issue involved. Using this.getI18nBean() at least allows to avoid duplicating the messages for the moment ...
I'm also a bit suspicious about the respective snippet from atlassian-plugin.xml as generated by 'atlas-create-bamboo-plugin' (and probably the source for all the plugins exhibiting this error accordingly), e.g. from https://bitbucket.org/atlassian/bamboo-sdk-examples/src/ed48459fc04e/part1/myfirstplugin/src/main/resources/atlassian-plugin.xml:
<resource type="i18n" name="myfirstplugin language" location="english"/>
In contrast the respective fragment from a working plugin looks like so:
<resource type="i18n" name="i18n" location="com.example.product.plugins.task.i18n"/>
The i18n.properties files is located within the addressed Maven folder hierarchy as usual, i.e. resources/com/example/product/plugins/task/i18n.properties. I've tried to refactor my Task plugin accordingly, but to no avail.
Thanks! That worked great. Regarding atlassian-plugin.xml - look at https://bitbucket.org/bob_swift/bamboo-groovy-task-plugin/src/tip/src/main/resources/atlassian-plugin.xml if you want my example.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's more what I'd expected indeed - I'll go ahead and refactor my resources along these lines as well, thanks for the example! Any guess on why the Plugin SDK seems to deviate from the established Maven standard directory layout here? Or might this simply be a bug in the code generator, which the weird 'name' composition seems to hint on?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Don't know. I borrowed that part from my other plugins.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Out of curiosity are you targetting Bamboo versions between 3.1 and 3.2? I think there might be the possability that another english.properties is being loaded from another plugin because they share the same package. Ill get someone to look into this.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, I've started with 'atlas-create-bamboo-plugin' from the Plugin SDK 3.7, which targets Bamboo version 3.3 by default. Thanks much for looking into this minor but spreading annoyance! There are several Bamboo Tasks out there suffering from this lack of validation error display already ;)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries Steffen - we take minor headaches for plugin developers very seriously and we have scheduled someone to take a look at it next week.
EDIT: You can follow the status here
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I'm making a custom repository plugin and here is what I had to add to my setTextProvider method to get i18n working:
@Override public synchronized void setTextProvider(TextProvider textProvider) { if (this.textProvider==null) { super.setTextProvider(textProvider); this.textProvider=textProvider; } if (getName() == null) { I18nBeanFactory i18nBeanFactory = i18nBeanFactoryReference.get(); this.textProvider = new TextProviderAdapter(i18nBeanFactory.getI18nBean(Locale.getDefault())); } }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.