Class LocaleHelper
java.lang.Object
com.broadleafcommerce.search.core.service.locale.LocaleHelper
Helper for retrieving the locale String value for an indexable type and context.
-
Constructor Summary
ConstructorsConstructorDescriptionLocaleHelper
(com.broadleafcommerce.translation.mapping.ContextLocaleHelper contextLocaleHelper) -
Method Summary
Modifier and TypeMethodDescriptionprotected com.broadleafcommerce.translation.mapping.ContextLocaleHelper
getLocale
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context, com.broadleafcommerce.search.api.type.IndexableType indexableType) Get the String representation of a locale for the context and indexable type.getQueryLocale
(com.broadleafcommerce.data.tracking.core.context.ContextInfo context, Locale locale, String defaultLocale) Get the String representation of a locale to be used in a query for the context and passed locale.protected SearchTenantProvider
protected com.broadleafcommerce.search.autoconfigure.SearchCommonTranslationProperties
void
setTenantProvider
(SearchTenantProvider tenantProvider) void
setTranslationProperties
(com.broadleafcommerce.search.autoconfigure.SearchCommonTranslationProperties translationProperties) protected boolean
useDefaultTenantLocale
(Locale contextLocale, com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo)
-
Constructor Details
-
LocaleHelper
public LocaleHelper(com.broadleafcommerce.translation.mapping.ContextLocaleHelper contextLocaleHelper)
-
-
Method Details
-
getLocale
@Nullable public String getLocale(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context, com.broadleafcommerce.search.api.type.IndexableType indexableType) Get the String representation of a locale for the context and indexable type.- Parameters:
context
- The context information surrounding sandboxing/multitenant stateindexableType
- the indexable type in this context- Returns:
- the locale String
-
getQueryLocale
@Nullable public String getQueryLocale(@Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo context, @Nullable Locale locale, @Nullable String defaultLocale) Get the String representation of a locale to be used in a query for the context and passed locale.- Parameters:
context
- The context information surrounding sandboxing/multitenant statelocale
- The locale to extract info fromdefaultLocale
- The default locale to return if the passed locale is null or matches the tenant locale- Returns:
- the locale String
-
useDefaultTenantLocale
protected boolean useDefaultTenantLocale(Locale contextLocale, @Nullable com.broadleafcommerce.data.tracking.core.context.ContextInfo contextInfo) -
getContextLocaleHelper
protected com.broadleafcommerce.translation.mapping.ContextLocaleHelper getContextLocaleHelper() -
getTranslationProperties
protected com.broadleafcommerce.search.autoconfigure.SearchCommonTranslationProperties getTranslationProperties() -
setTranslationProperties
@Autowired public void setTranslationProperties(com.broadleafcommerce.search.autoconfigure.SearchCommonTranslationProperties translationProperties) -
getTenantProvider
-
setTenantProvider
-