I18n properties file not loaded in plugin

Hi there,
following a recommendation of Atlassian, i used a plugin-key not following the usual “${project.groupId}.${project.artifactId}” format. For SEO it was recommended to use something like “mycompany-myplugin-for-confluence”. That’s what I did in pom.xml:

   <properties>
      <confluence.version>6.12.2</confluence.version>
      <confluence.data.version>6.12.2</confluence.data.version>
      <amps.version>6.3.6</amps.version>
      <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
      <atlassian.spring.scanner.version>2.1.3</atlassian.spring.scanner.version>
      <!-- <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key> -->
      <atlassian.plugin.key>mycompany-myplugin-for-confluence</atlassian.plugin.key>
   </properties>

I noticed that when I do that, the i18n language properties files are not loaded anymore. Those are referenced in atlassian-plugin.xml like this:

   <resource type="i18n" name="i18n" location="${project.artifactId}"/>

It works fine when I use the old plugin-key format.
How can I get the language files loaded with that new different plugin-key?

Creating new key shouldn’t have affected this.
I think you want to change this -

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>companyName</groupId>
    <artifactId>myplugin-for-confluence</artifactId>
    <version>1.0.0</version>

instead of the key you show in you code.

Hi Suarabh,
thanks for yor input. I tried your suggestion and every other combination of groupId, artifactId and location - to no success.
As soon as I change back the plugin key to the old ${project.groupId}.${project.artifactId} and location="${project.artifactId}" it works.
However, my problem is that if I change the key back, the plugin is considered as a different plugin. I cannot update the existing entry with it anymore.

I am not able to follow. Can you show by examples.
Also if you change the group id or artifact id, it will be considered as new plugin. I don’t know if there is a workaround for this.

Here is an example. I started with this in pom.xml:

   <modelVersion>4.0.0</modelVersion>
   <groupId>com.mycompany.confluence.plugins</groupId>
   <artifactId>myplugin</artifactId>
   <version>2.1.0</version>
   ...
   <properties>
      <confluence.version>6.12.2</confluence.version>
      <confluence.data.version>6.12.2</confluence.data.version>
      <amps.version>6.3.6</amps.version>
      <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
      <atlassian.spring.scanner.version>2.1.3</atlassian.spring.scanner.version>
      <atlassian.plugin.key>${project.groupId}.${project.artifactId}</atlassian.plugin.key>
   </properties>

In atlassian-plugin.xml I used:

   <resource type="i18n" name="i18n" location="${project.artifactId}"/>

Using Atlassian’s SDK 6.3.12 it builds and works ok. The language files (located in the same directory as atlassian-plugin.xml) are loaded and macro dialogs e.g. show the text strings.

Then I simply changed the plugin key like this in pom.xml:

   <properties>
      <confluence.version>6.12.2</confluence.version>
      <confluence.data.version>6.12.2</confluence.data.version>
      <amps.version>6.3.6</amps.version>
      <plugin.testrunner.version>1.2.3</plugin.testrunner.version>
      <atlassian.spring.scanner.version>2.1.3</atlassian.spring.scanner.version>
      <atlassian.plugin.key>mycompany-myplugin-for-confluence</atlassian.plugin.key>
   </properties>

After that, the plugin still builds without errors. All features work as well, but none of the language strings are shown. The macro dialogs for example show the form fields but not the labels and description anymore.

I hope that explains it a little better. I changed the i18n location to several other values and combinations I could think of, but to no success.

Hi @george,

double check the i18n keys for your macro display texts.
There is a naming convention that expects the app key to be part of the i18n keys. If you change the app key you’ll also need to adapt the i18n keys - at least for the macros. I think it’s also possible to specify explicit macro i18n keys in the macro definition in atlassian-plugin.xml, but that’s probably more work.

Concerning the SEO-compatible app key: I think this information is outdated for a few months now. Actually the marketplace no longer puts the app key in the URL, instead it generates a slug based on the app name. So you might not need to change your app key in the first place.

An example:
Our Scroll PDF Exporter app has the name Scroll PDF Exporter for Confluence and the app key is com.k15t.scroll.scroll-pdf.

The marketplace URL formerly used to be:
https://marketplace.atlassian.com/plugins/com.k15t.scroll.scroll-pdf
but nowadays it is:
https://marketplace.atlassian.com/apps/7019/scroll-pdf-exporter-for-confluence

Note that both URLs work to reach the marketplace listing.

Cheers,
Jens

1 Like

Hi @jens ,

awesome, that was it. The properties files still contained th old app key instead of the new. So it was not a matter of not finding the files but that the string IDs inside were incorrect.

Since you say that Atlassian now creates its own Marketplace URL from the app name I guess I will stick with the old ${project.groupId}.${project.artifactId} format for new apps.

Thanks and best regards,
George