Access the current user's language in a plugin

Is it possible to access a logged in user’s language settings via the plugin api in javascript?

I.e.: in my plugin initializer:

function initializePlugin(api) {
  const currentUser = api.getCurrentUser();
  console.log(currentUser.language) // Is this possible?
}

Looking through the object, I’m not seeing the field I would use. It does look like it’s accessible through Ruby:

user.effective_local

Is that the only place?

I18n.locale has the current user’s locale.

7 Likes