code: public Locale getCurrentUserLocale(PortletRequest request) {
          final HttpServletRequest originalPortalRequest =
                  this.portalRequestUtils.getPortletHttpRequest(request);
          IUserInstance ui = userInstanceManager.getUserInstance(originalPortalRequest);
          IUserPreferencesManager upm = ui.getPreferencesManager();
          final IUserProfile userProfile = upm.getUserProfile();
          LocaleManager localeManager = userProfile.getLocaleManager();
  
          // first check the session locales
          List<Locale> sessionLocales = localeManager.getSessionLocales();
          if (sessionLocales != null && sessionLocales.size() > 0) {
              return sessionLocales.get(0);
          }
  
          // if no session locales were found, check the user locales
          List<Locale> userLocales = localeManager.getUserLocales();
          if (userLocales != null && userLocales.size() > 0) {
              return userLocales.get(0);
          }
  
          // if no selected locale was found either in the session or user layout,
          // just return null
          return null;
      }
docs: Return the current user's locale.
  
  @param request The current {@link PortletRequest}
  @return