It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Confluence Language

I am trying to add a Change Language menu item to the top navigation header in Confluence. The code below works. However, it only detects the browser locale instead of the language specified within the users profile.

How can I detect the user language via AJS?

<script> AJS.toInit(function(){ var browserLang = navigator.language || navigator.userLanguage;     if(browserLang =="en-CA"){ AJS.$('.aui-header-secondary .aui-nav').append('<li><a href="/cra/language/languageswitch.action" class=" aui-nav-imagelink">English</a></li>');} else { AJS.$('.aui-header-secondary .aui-nav').append('<li><a href="/cra/language/languageswitch.action" class=" aui-nav-imagelink">French</a></li>'); } }); </script>

1 answer

I found the answer to be AJS.params.userLocale

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted in Confluence

Lessons and Learnings: Six Months of Working Remote [Discussion]

Hey there, folks! For most of us, the past six months- yes, you read that right- have been a journey. More people than ever before have pivoted to working remotely, and navigating being on-scre...

5,343 views 4 6
Join discussion

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you