Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

How does Confluence handle localization?

Alex Yasurek
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2014

Hi,

I am working on a Confluence theme and have to do some localization on a few UI elements. I was wondering if anyone knows how Confluence handles this in their default theme. I have a browser setup with the default langauge as Japanese and when I visit the site, the default confluence UI is translated to Japanese. I would like to know how they do this and if it's better than what I am doing. I am just writing Javascript like so:

AJS.toInit(function(){

var browserLang = navigator.language || navigator.userLanguage;

if(browserLang =="ja"){

AJS.$('#some-button').text("japanese text here");

AJS.$('#some-other-button').text("japanese text here");\

etc..

}

}

Even though this seems to work fine, maybe there is a much better way of handling things like this. I wondering if Confluence does this the same way or if they just load different themes depending on browser langauge or ?

Thanks

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

3 votes
Gorka Puente _Appfire_
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
August 13, 2014

Hi,

I don't know in themes, but in plugin development, internationalisation is done like this in js:

AJS.I18n.getText("properties.key");

For that, you need in your atlassian-plugin.xml

<web-resource name="Whatever Resources" key="whateverResources">
    	<transformation extension="js">
            <transformer key="jsI18n"/>
        </transformation>
...

You can find more information here https://developer.atlassian.com/display/AUI/AJS.I18n.getText

Hope this helps!

Gorka

1 vote
Dennis Andersen
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 13, 2014

As Gorka stated, you'll need to specify in your xml that you'd like to add the i18n transformer to your resources. When done you can access your properties through js with

AJS.I18n.getText

Here's more on how you write your properties files, you'll find file names and locations needed for you to access the properties here: https://developer.atlassian.com/display/DOCS/Internationalising+your+plugin

And here is some more info on how Confluence names their properties files:

https://developer.atlassian.com/display/CONFDEV/I18N+Architecture

Dennis

0 votes
Deividi Luvison
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2014

Hey Alex,

I'm not an expert developer but I know a few things regarding how Confluence handles the default languages.

Instead of doing that what happens if you install the japanse language pack and then switch the default language to japanes as per below two guides?

https://confluence.atlassian.com/display/DOC/Installing+a+Language+Pack

https://confluence.atlassian.com/display/DOC/Choosing+a+Default+Language

Hope it helps.

Thanks and Regards,
David|Confluence Support Engineer
Alex Yasurek
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2014

Hi,

Thats for confluence built in UI. I was just wondering in general how they handle localization, like do they use javascript, vm files, or something else to show UI elements in different languages. I added some new UI elements to my theme so confluence won't translate those automatically which is why I am doing it using javascript. Just wondering if there is a better way.

Thanks

Deividi Luvison
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 12, 2014

Sorry buddy, in that case I really dont know :(.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events