Hi @bjansdeb,
I’ve tried something you can test on your own system if you’re not afraid to add four lines of PHP code to a file! 😁
This has been tested on CA version 2.0.9, which I used as a test environment.
In your providence directory, go to /app/lib/Browse/ and make a copy of the file BrowseEngine.php to save the original untouched file!
Edit the BrowseEngine.php file, at about the line #3858. This corresponds to the moment when the code is selecting the "WHERE" conditions for the SQL request, in the "type = label" case of a facet.
So you should have this code here:
if (isset($va_facet_info['preferred_labels_only']) && $va_facet_info['preferred_labels_only'] && $t_label->hasField('is_preferred')) {
$va_where_sql[] = "l.is_preferred = 1";
}
Copy-paste this piece of code just after:
global $g_ui_locale_id;
if (isset($va_facet_info['restrict_to_user_locale']) && $va_facet_info['restrict_to_user_locale']) {
$va_where_sql[] = "l.locale_id = '$g_ui_locale_id'";
}
Explanation:
- 1st line get the locale_id of the user (a global variable).
- 2nd line checks whether the optional parameter
restrict_to_user_locale = 1 is present in the browse.conf file for the desired facet.
- 3rd line properly add a WHERE clause that selects only facets corresponding to the user's locale.
Save.
Now, edit your browse.conf file, go to the desired facet and add the "restrict_to_user_locale = 1," line, as:
title_facet = {
type = label,
sort_by = [name],
restrict_to_types = [],
restrict_to_user_locale = 1,
preferred_labels_only = 1,
group_mode = alphabetical,
label_singular = _("label"),
label_plural = _("labels")
},
Et voilà !
Hope this will work for you as it works for me.
Screen captures:
- With restrict_to_user_locale = 0 (display english and french labels):

- With restrict_to_user_locale = 1 (display english labels only):

(Perhaps we could add this to the official code if @seth agrees.)