diff --git a/config/alfresco/templates/webscripts/org/alfresco/repository/facet/facetable-properties.get.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/repository/facet/facetable-properties.get.desc.xml index 2d1c20dffc..db9c2e804b 100644 --- a/config/alfresco/templates/webscripts/org/alfresco/repository/facet/facetable-properties.get.desc.xml +++ b/config/alfresco/templates/webscripts/org/alfresco/repository/facet/facetable-properties.get.desc.xml @@ -34,8 +34,8 @@ } ]]> - /api/facet/classes/{classname}/facetable-properties?nsp={namespacePrefix?}&skipCount={skipCount?}&maxItems={maxItems?} - /api/facet/facetable-properties?nsp={namespacePrefix?}&skipCount={skipCount?}&maxItems={maxItems?} + /api/facet/classes/{classname}/facetable-properties?nsp={namespacePrefix?}&skipCount={skipCount?}&maxItems={maxItems?}&locale={locale?} + /api/facet/facetable-properties?nsp={namespacePrefix?}&skipCount={skipCount?}&maxItems={maxItems?}&locale={locale?} argument user required diff --git a/config/alfresco/web-scripts-application-context.xml b/config/alfresco/web-scripts-application-context.xml index 19358905b8..5d75a1ff3d 100644 --- a/config/alfresco/web-scripts-application-context.xml +++ b/config/alfresco/web-scripts-application-context.xml @@ -1825,7 +1825,6 @@ id="webscript.org.alfresco.repository.facet.facetable-properties.get" class="org.alfresco.repo.web.scripts.facet.FacetablePropertiesGet" parent="baseSolrFacetConfigAdminWebscript"> - executeImpl(final WebScriptRequest req, final Status status, final Cache cache) @@ -73,6 +80,9 @@ public class FacetablePropertiesGet extends AbstractSolrFacetConfigAdminWebScrip @Override protected Map unprotectedExecuteImpl(WebScriptRequest req, Status status, Cache cache) { + final String userLocaleString = req.getParameter(QUERY_PARAM_LOCALE); + final Locale userLocale = (userLocaleString == null) ? Locale.getDefault() : new Locale(userLocaleString); + // There are multiple defined URIs for this REST endpoint. Some define a "classname" template var. Map templateVars = req.getServiceMatch().getTemplateVars(); final String contentClassName = templateVars.get(TEMPLATE_VAR_CLASSNAME); @@ -91,11 +101,11 @@ public class FacetablePropertiesGet extends AbstractSolrFacetConfigAdminWebScrip final SortedSet facetableProperties; if (contentClassQName == null) { - facetableProperties = toFacetablePropertyDataSet(facetService.getFacetableProperties()); + facetableProperties = toFacetablePropertyDataSet(facetService.getFacetableProperties(), userLocale); } else { - facetableProperties = toFacetablePropertyDataSet(facetService.getFacetableProperties(contentClassQName)); + facetableProperties = toFacetablePropertyDataSet(facetService.getFacetableProperties(contentClassQName), userLocale); } // The webscript allows for some further filtering of results: @@ -162,18 +172,18 @@ public class FacetablePropertiesGet extends AbstractSolrFacetConfigAdminWebScrip } /** This method returns a {@link FacetablePropertyData} for the specified {@link PropertyDefinition}. */ - private FacetablePropertyData toFacetablePropertyData(PropertyDefinition propDef) + private FacetablePropertyData toFacetablePropertyData(PropertyDefinition propDef, Locale locale) { - String title = propDef.getTitle(dictionaryService); + String title = propDef.getTitle(messageLookup, locale); return new FacetablePropertyData(propDef, title); } - private SortedSet toFacetablePropertyDataSet(Collection propDefs) + private SortedSet toFacetablePropertyDataSet(Collection propDefs, Locale locale) { SortedSet result = new TreeSet<>(); for (PropertyDefinition propDef : propDefs) { - result.add(toFacetablePropertyData(propDef)); + result.add(toFacetablePropertyData(propDef, locale)); } return result; }