Custom search path on a multilingual site

Created on 20 April 2023, about 1 year ago
Updated 31 October 2023, 8 months ago

Problem/Motivation

We are trying to get this module working in a multilingual environment using a custom search path. If I set the custom search path to "search/site" the user in both the cases where a user goes to "mysite/en/my-bad-path" and "mysite/fr/my-bad-path" the user always redirected to "mysite/search/site?search_api_fulltext=my bad path". If I configure the custom search path to "en/search/site" then at least the English redirect works fine, but again the French user (mysite/fr/my-bad-path) is redirected to "mysite/en/search/site?search_api_fulltext=my bad path" which is not allowed for Government of Canada websites.

Steps to reproduce

1. Install a multilingual site or use a multilingual distribution like DrupalWxt
2. Install this module
3. Configure this module as follows:
- use custom search path: TRUE
- custom search path: en/your/search/path?keys=@keys
- enable ignore language code so you don't get en/fr in your search keys
4. Go to yoursite/en/my-bad-path and see it works fine
5. Go to yoursite/fr/my-bad-path and see that it redirects to En.

Proposed resolution

One possible solution would be to make the custom search path configuration translatable, check the language and load the translation if needed. There may be other options as well.

Remaining tasks

If the decision is to make the custom search path translatable then potentially we will need a schema update for sites with this module already enabled.

User interface changes

Add a configuration translation option.

API changes

None.

Data model changes

None.

✨ Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada joel_osc

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @joel_osc
  • Status changed to Needs review about 1 year ago
  • Open on Drupal.org β†’
    Core: 9.5.x + Environment: PHP 7 & MySQL 5.5
    last update about 1 year ago
    Waiting for branch to pass
  • πŸ‡¨πŸ‡¦Canada joel_osc

    Here is a patch that implements the translatable configuration. Cheers!

  • Status changed to Needs work 8 months ago
  • πŸ‡©πŸ‡ͺGermany Anybody Porta Westfalica

    @joel_osc this is indeed important, thank you @joel_osc

    I'm not sure, if the changes to the controller are really needed and if this is best-practice. Shouldn't a .config_translation.yml do the job for the translatable config values instead?

    Would you mind providing a MR and having a look at the best practices?

    Happy to review.

Production build 0.69.0 2024