diff --git a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/ivydata/service/impl/LanguageService.java b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/ivydata/service/impl/LanguageService.java index 2f2e721c406..8216abd1bf1 100644 --- a/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/ivydata/service/impl/LanguageService.java +++ b/AxonIvyPortal/portal/src/ch/ivy/addon/portalkit/ivydata/service/impl/LanguageService.java @@ -61,7 +61,11 @@ public IvyLanguage getIvyLanguageOfUser() { } public String getUserLanguage() { - return loadLanguage(IUser::getLanguage); + String languageTag = loadLanguage(IUser::getLanguage); + if (languageTag == StringUtils.EMPTY) { + return getDefaultLanguage().toLanguageTag(); + } + return languageTag; } public String getUserFormatLanguage() { @@ -75,9 +79,7 @@ private String loadLanguage(Function userLocaleLoader) { } else { Locale apply = userLocaleLoader.apply(Ivy.session().getSessionUser()); languageTag = Objects.nonNull(apply) ? apply.toLanguageTag() : languageTag; - if (languageTag == StringUtils.EMPTY) { - return getDefaultLanguage().toLanguageTag(); - } + } return languageTag; }