User locale is not set during the Register event

I’m implementing Event Listener SPI to trigger some API calls during the REGISTER event. Internationalization is enabled but when the event is fired the locale attribute of the user is null. It’s filled after the event listener is fired probably. During the LOGIN event, the user attribute is not null anymore.

Sample code:

	public void onEvent(Event event) {
		UserModel user = session.users().getUserById(session.getContext().getRealm(), event.getUserId());
		String locale = user.getFirstAttribute("locale"); // locale is null

Is there any other way to get the locale during the initial registration phase? I checked out the event object but couldn’t find anything helpful in it.

In case anyone encounters a similar issue, I went with using the login event instead of register. I added an extra user attribute to set at the first login in order not to repeat the same action in later logins. The register event is fired very early that one cannot get much data at that stage.