- When a user accidentally chooses another language they get stuck in the URL and renders all links unusable. Users have to either manually enter /en/ or clear cache to get back to English.
- DXP 7.4
The correct way to get back to the default locale is removing the locale code from the URL and returning them to their correct state or you can try adding the following portal property (setting it to 0), which controls this functionality.
# Set this to 0 if the locale is not automatically prepended to a URL. This
# means that each URL could potentially point to many different languages.
# For example, the URL http://localhost:8080/web/guest/home could then be
# viewed by users in many different languages.
# Set this to 1 if the locale is automatically prepended to a URL when the
# requested locale is not the default locale. This means that each URL
# points to just one language. For example, the URL
# http://localhost:8080/web/guest/home would point to the default language.
# The URL http://localhost:8080/zh/web/guest/home and
# http://localhost:8080/zh_CN/web/guest/home would both point to the Chinese
# In cases where the prepended locale is "zh" and not the complete locale
# "zh_CN", then the full locale returned will be based on the order in which
# the locales appear in the property "locales". If "zh_CN" appears before
# "zh_TW", then "zh" will be a short hand for "zh_TW".
# The default language is set in system.properties with the properties
# "user.country" and "user.language".
# Set this to 2 if the locale is automatically prepended to every URL. This
# means that each URL points to just one language.
# Set this to 3 if the locale is automatically prepended to a URL when the
# requested locale is not the default user locale. In the case of guest
# users, the behavior is the same as having a value of 1.
# Note that each language requires an entry in the property "locales" and a
# servlet mapping in web.xml for the I18n Servlet.
# Env: LIFERAY_LOCALE_PERIOD_PREPEND_PERIOD_FRIENDLY_PERIOD_URL_PERIOD_STYLE
If for some reason the first resolution doesn't fix the issue, the other language may not be available in locale instance and you can try setting the following property to
If this property is
# Set this to false to return an HTTP 404 status code and page if the
# requested URL includes a locale that is not available among the locales
# set in the "locales" and "locales.beta" properties.
# For example, if Spanish is not one of the available locales and
# http://localhost:8080/es/web/guest is requested, then a 404 error code and
# page is returned.
# This can improve SEO since it avoids duplicated pages, if in the
# installation, there are a set of defined locales available.
# Env: LIFERAY_LOCALE_PERIOD_USE_PERIOD_DEFAULT_PERIOD_IF_PERIOD_NOT_PERIOD_AVAILABLE
true, the portal automatically redirects to the default locale if you try to switch it to an unavailable locale.
Contenido exclusivo para suscriptores.
Una Suscripción Enterprise de Liferay proporciona acceso a más de 1.500 artículos que incluyen las mejores practicas, diagnóstico de problemas y otras soluciones útiles. Inicia sesión para tener un acceso completo.Inicia sesión