From 22ef594bb1e7eb969ff08e047edc3ae48236c34a Mon Sep 17 00:00:00 2001 From: Nguyen Hung Thinh <117440893+nhthinh-axonivy@users.noreply.github.com> Date: Wed, 28 Aug 2024 11:28:55 +0700 Subject: [PATCH] Update LanguageService.java (#992) Update LanguageService.java _ Handle GUI test --- .../ivydata/service/impl/LanguageService.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) 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; }