Hello!
I saw some examples in Jira's code about using AJS.I18n:
AJS.I18n.getText("common.words.close");
Also I read these docs.
But for some reason, when I execute it from my plugin or from Firebug it returns the same common.words.close
Does any one know how to use it?
Community moderators have prevented the ability to post new answers.
AJS.I18n.getText() requires pre-processing on the server side. It does not do any magic on the client side :)
To switch on i18n preprocessing you need to configure appropriate transformation.
In your atlassian-plugin.xml you need something like:
<web-resource key="your-resource-key"> <transformation extension="js"> <transformer key="jsI18n"/> </transformation> ... <resource type="typehere" name="yourjavascriptfile.js" location="yourlocationofthefileinpluginstructure.js" /> ...
All this applies for files which are generally interpreted by the browser (like javascript or CSS).
If you need i18n in your standard Velocity templates (fully processed on the server side) then you don't need to bother with AJS.I18n.getText() at all. Just use getText("your.i18n.key") method which is available in all webwork actions via JiraActionSupport superclass.
Great! It worked :)
Thanks a lot :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Still not working for me. Could you please suggest a way to debug the issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
can't you do this?
create a i18n.properties file on theresources.
Then add it on your plugin descriptor
<resourcetype="i18n" location="i18n/i18n" name="i18n" />
and then call the i18n messages this way:
label: gadget.getMsg("gadget.workloadpie.field.issuetimetype.name")
At least this seems to work fine, i haven't proved the other way.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
In previous example I used standard Jira's resource message common.words.close
- it should be availaible anywhere, I suppose.
And I need this functionality not in gadget, but in web-work action, in velocity template.
With my custom properties file it wont work either.
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.