Bug 39118

Summary: Make facet labels translatable
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: Searching - ElasticsearchAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: anneli.osterman, jonathan.druart, koha, roman.dolny
Version: unspecified   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: ---
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 38136, 35138    
Bug Blocks:    

Description Caroline Cyr La Rose 2025-02-12 21:50:50 UTC
Bug 35138 made adding or modifying facets much easier. However, and it was pointed out at the start of the bug report, user-created facets (or user-modified facets) aren't translatable.

It would be great if we could have a way of translating them (without using the JS hack).

To recreate:
1. Make sure your installation is using ElasticSearch (if using ktd, do `ktd --es7 up` or `ktd --es8 up`)

2. Make sure your installation has at least two languages
   2.1. Install new language
        ktd --shell --root
        koha-translate --install fr-CA --dev kohadev
   2.2. Go to Administration > System preferences
   2.3. Search for languages
   2.4. Check the new language in OPACLanguages and StaffInterfaceLanguages
   2.5. Click 'Save all I18N/L10N preferences'

3. Add a facet (for example, Genre/Form on 655$a in MARC21)
   3.1. Go to Administration > Search engine configuration (Elasticsearch)
   3.2. In the 'Search fields' tab, find index-term-genre
   3.3. Change the label to 'Genre/Form'
   3.4. Click 'Save'
   3.5. Go to the 'Bibliographic records' tab
   3.6. In the last row of the 'Facet order' table, choose 'index-term-genre'
   3.7. Click 'Add'
   3.8. Click 'Save'
   3.9. Go to the 'Bibliographic records' tab again
   3.10. Find index-term-genre and change 'Facetable' to 'Yes'
   3.11. Click 'Save'

4. Reindex
   ktd --shell
   ./misc/search_tools/rebuild_elasticsearch.pl -b -v -d
   (DO NOT USE -r or all your work in step 3 will be lost :((( )

5. Search for "comedy" in the staff interface catalog
   --> The new facet is there with its label "Genre/Form"

6. Switch the interface to the other language

7. Redo step 5
   --> The new facet's label is not translated

8. Search for "comedy" in the staff OPAC catalog
   --> The new facet is there with its label "Genre/Form"

9. Switch the OPAC to the other language

10. Redo step 8
    --> The new facet's label is not translated

Note: "Hardcoded" facets, such as Authors, Topics, etc. are currently translatable.
Comment 1 Jonathan Druart 2025-02-13 08:55:04 UTC
We need bug 38136
Comment 2 Anneli Österman 2025-05-15 09:24:35 UTC
We could really need this one because we have added many facets of our own. :)