Confluence I18n in JavaScript resource

Hi,

I’m trying to get AJS.I18n.get('de.cyclonit.confluence.plugins.test.test-macro.desc') to work in my plugin, but instead of getting the value I get the following error:

Error loading I18n for de.cyclonit.confluence.plugins.test.test-macro.desc⁠:error

The relevant part of my atlassian-plugin.xml looks like this:

    <web-resource key="test-resources" name="Test Web Resources">
        <dependency>com.atlassian.auiplugin:ajs</dependency>

        <transformation extension="js">
            <transformer key="jsI18n" />
        </transformation>

        <resource type="download" name="test-macro-browser.js" location="/js/test-macro-browser.js"/>

        <context>macro-browser</context>
    </web-resource>

my test-macro-browser-js:

AJS.toInit(function() {
    alert(AJS.I18n.get('de.cyclonit.confluence.plugins.test.test-macro.desc'));
});

and my test.properties:

de.cyclonit.confluence.plugins.test.test-macro.desc = Testing

Can anyone tell me what I’m doing wrong?

Dear @christ.klinge,

you defined the overall i18n resource in your plugin.xml?

<!-- add our i18n resource -->
    <resource type="i18n" name="i18n" location="myi18nfile"/>

Regards,
Alexander

@alexander.kueken,

yes that’s in place.

<resource type="i18n" name="i18n" location="test"/>

Check your generated jar, does it contain the test.properties file?
If not, does your pom.xml contains

<resources>
    <resource>
        <directory>src/main/resources</directory>
    </resource>
</resources>

under the <build> tag?

Hi @Panos,

I’ve never seen that one before. For testing, I added it as a chield to the build-tag, is that correct? If so, it didn’t change anything.

Kind regards,
Christopher

Yeah it should be as child of build. But you didn’t answer the other part, does your jar contain the rest.properties file? You can just extract it with a zip app

Yes it does. Using the i18n-values to translate macro parameters and such does work fine too. It doesn’t work in JavaScript only.