# \[IGN-3498\]Change language according Active Directory logged user

**URL:** <https://forum.inductiveautomation.com/t/ign-3498-change-language-according-active-directory-logged-user/61767>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [July 12, 2022, 1:15am UTC](https://forum.inductiveautomation.com/t/ign-3498-change-language-according-active-directory-logged-user/61767 "2022-07-12T01:15:36Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![AlexandreFG](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/alexandrefg/32/74162_2.png) [@AlexandreFG](https://forum.inductiveautomation.com/u/AlexandreFG)\
**Post date:** [July 12, 2022, 1:15am UTC](https://forum.inductiveautomation.com/t/ign-3498-change-language-according-active-directory-logged-user/61767/1 "2022-07-12T01:15:36Z")

</div>

Hello guys! I don't know if it's possible, but i need to change the language automatically every time that I logged-in using Active directory.

Put this code in Client event Script - Startup

```auto
userName = system.security.getUsername()
user = system.user.getUser("", userName)
system.util.setLocale(user.get('language'))

```

Without Active Directory I use a simple script and I configure the language inside each user. It's simple, but when i use Active Directory, I don't know how read the language

I found a topic with the same question, but it didn't have any answers.  
Have some way to do this?

---

<div class="post-metadata">

**Author:** ![catherine.fowler](https://avatars.discourse-cdn.com/v4/letter/c/34f0e0/32.png) [@catherine.fowler](https://forum.inductiveautomation.com/u/catherine.fowler)\
**Post date:** [March 28, 2023, 3:12pm UTC](https://forum.inductiveautomation.com/t/ign-3498-change-language-according-active-directory-logged-user/61767/2 "2023-03-28T15:12:56Z")

</div>

Did you ever figure out how to do this? I'd like to do the same, but in Ignition 8.1 Perspective. I also could get it to work for internal user sources, but not for AD. I got as far as setting the `preferredLanguage` attribute on my user in the Active Directory, but I can't seem to read it from Ignition.

---

<div class="post-metadata">

**Author:** ![catherine.fowler](https://avatars.discourse-cdn.com/v4/letter/c/34f0e0/32.png) [@catherine.fowler](https://forum.inductiveautomation.com/u/catherine.fowler)\
**Post date:** [March 28, 2023, 4:16pm UTC](https://forum.inductiveautomation.com/t/ign-3498-change-language-according-active-directory-logged-user/61767/3 "2023-03-28T16:16:26Z")

</div>

For anyone else searching for a solution, I found a bit of a hacky workaround that at least works for 8.1.

It looks like only a subset of the Active Directory attributes are accessible from Ignition and they're by default set up to populate certain default properties of a user in Ignition. However, if you go into the advanced properties of the Active Directory, there's nothing to stop you from changing what attribute they're _actually_ using. So, if you change one of them from its default to `preferredLanguage`, you can access that attribute via the property it's supposed to represent.

For example, you can override the phone contact info like this:  
 ![image](https://us1.discourse-cdn.com/inductiveautomation/original/3X/2/6/2610c30769540bd1edcacfd0dfd336256079f955.png)

Then use the phone contact information in your script to access the language:

```auto
user = system.user.getUser("", userName)
	
# Default to english
language = "en"
for contactInfo in user.getContactInfo():
	# Phone number has been mapped to preferredLanguage
	if contactInfo.getContactType() == "phone":
		language = contactInfo.getValue()

```

Note that the above is a fragment - get userName and set your locale however you like for your application. For me, I put a binding on the session prop `locale` pointed at the session prop `auth.user`, used `value.userName` to get my username, and returned `language` to set the locale.

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [March 28, 2023, 4:27pm UTC](https://forum.inductiveautomation.com/t/ign-3498-change-language-according-active-directory-logged-user/61767/4 "2023-03-28T16:27:14Z")

</div>

Adding the ability to fetch arbitrary AD attributes is on our roadmap 🙂

---

<div class="post-metadata">

**Author:** ![indenkleefj](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/indenkleefj/32/10961_2.png) [@indenkleefj](https://forum.inductiveautomation.com/u/indenkleefj)\
**Post date:** [January 13, 2025, 12:55pm UTC](https://forum.inductiveautomation.com/t/ign-3498-change-language-according-active-directory-logged-user/61767/5 "2025-01-13T12:55:28Z")

</div>

What is the current status of this?

---

<div class="post-metadata">

**Author:** ![paul-griffith](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/paul-griffith/32/37249_2.png) [@paul-griffith](https://forum.inductiveautomation.com/u/paul-griffith)\
**Post date:** [January 13, 2025, 4:54pm UTC](https://forum.inductiveautomation.com/t/ign-3498-change-language-according-active-directory-logged-user/61767/6 "2025-01-13T16:54:24Z")

</div>

The work has been completed in 8.3.0. A public beta is expected in the next few months, with a public release some time after.
