LPS-37809 Add a new algorithm when prepending languages when browsing portal URLs: If browser receives a link to a localized portal URL, it will keep that locale to read the link in that language (www.example.com/es/web/guest); if browser receives a link to a not localized portal URL, it will display the link in user's preferred language (www.example.com/web/guest)
LPS-37809 Source formatting
LPS-37809 We need to keep the guestLanguageId as the userLanguageId becuase otherwise we break the use case for LOCALE_PREPEND_FRIENDLY_URL_STYLE=1
LPS-37809 If the preferred locale of the user is not the same as current locale we need to include the language path (same case as LOCALE_PREPEND_FRIENDLY_URL_STYLE=1). Otherwise do not include it.
LPS-37809 If LOCALE_PREPEND_FRIENDLY_URL_STYLE=3 but the user is not logged in, the portal should behave as LOCALE_PREPREND_FRIENDLY_URL_STYLE=1 (add the language path to the url when the language of the user doesn't match the default locale of the porta)
LPS-37809 Describe that in case of guest users the portal will behave as locale.prepend.friendly.url.style=1
LPS-37809 By default the portal will follow this new behaviour.
LPS-37809 Extract prepend language logic to a method
LPS-37809 Source formatting
LPS-37809 Add a new parameter improving testability
LPS-37809 Test for new algorithm
LPS-37809 Use a parameter to decide if we want to persist the new language or not (only store it in session and cookie) By default it will persist the new language (backwards compatibility)
LPS-37809 When the current locale doesn't match the user preferred locale display a message allowing the user to display the page in his preferred locale or set the current locale as his preferred locale
LPS-37809 Display messages in the user locale (not the current locale)
LPS-37809 Improve service test api to add users with different locales
LPS-37809 Format source
LPS-37809 We can remove this code because the Filter only maps request /web/* /group/* /user*/ so we will never have a languageId from the URI of the request
LPS-37809 Do not use !=, use .equals. Also, themeDisplay.getLocale() has an implicit var "locale"
LPS-37809 Fix wrong var
LPS-37809 SF