Skip to content

Commit

Permalink
Use browser locale when user locale is missing
Browse files Browse the repository at this point in the history
  • Loading branch information
fcrespel committed Dec 13, 2024
1 parent 58f622f commit e4cb45d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/main/java/me/crespel/karaplan/domain/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import jakarta.validation.constraints.NotNull;

import org.hibernate.annotations.SortComparator;
import org.springframework.context.i18n.LocaleContextHolder;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
Expand Down Expand Up @@ -101,6 +102,9 @@ public Locale getLocaleParsed() {
if (locale != null) {
localeParsed = Locale.forLanguageTag(locale);
}
if (locale == null) {
localeParsed = LocaleContextHolder.getLocale();
}
return localeParsed;
}

Expand Down

0 comments on commit e4cb45d

Please sign in to comment.