public class LocaleUtils extends Object
Constructor and Description |
---|
LocaleUtils(CdsProperties properties) |
Modifier and Type | Method and Description |
---|---|
Locale |
getLocale(String sapLocaleQueryParam,
String acceptLanguageHeader,
String sapLanguageQueryParam,
String xSapLanguageHeader)
Determines the locale for a request.
|
static Locale |
getLocaleForBundle(Locale locale)
Determines the locale used for resource bundle lookups
|
static String |
getLocaleStringForQuery(Locale locale)
Returns the correct locale String for the sap-language query parameter
|
static String |
getLocalizedEntityName(String entity)
Calculates the localized entity name that can be used to access localized
fields
|
public LocaleUtils(CdsProperties properties)
public Locale getLocale(String sapLocaleQueryParam, String acceptLanguageHeader, String sapLanguageQueryParam, String xSapLanguageHeader)
sapLocaleQueryParam
- Value of "sap-locale" query parameteracceptLanguageHeader
- Value of accepted language header parametersapLanguageQueryParam
- Value of "sap-language"query parameterxSapLanguageHeader
- Value of "x-sap-request-language" query parameterpublic static String getLocalizedEntityName(String entity)
entity
- the entity namepublic static String getLocaleStringForQuery(Locale locale)
locale
- the localeCopyright © 2023. All rights reserved.