I have installed this module and created a view and added in an exposed form of taxonomy term. My site is multi lingual and I have translations for the above mentioned taxonomy terms. The problem is when I try to switch between languages the language is not switching and showing the default language.

Issue fork shs-2921239

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

aby v a created an issue. See original summary.

aby v a’s picture

Title: Not working with multi langauge. Transulation is not working when switching between languages. » Not working on multi lingual site. Translation is not working when switching between languages.
igalafate’s picture

As long as I can see this issue was not fixed in D7 (https://www.drupal.org/project/shs/issues/2725295) either. I have been debugging it and we always get the default language in the ajax controller function because is not set in the baseUrl in the ajax call. So I suggest to change the baseUrl from "/shs-term-data" to "/{current_langcode}/shs-term-data" where {current_langcode} is the current langcode.

I am not really sure if this is the correct place to set the language, any suggestion?

gugalamaciek’s picture

Consider scenario:
1. Open node page using shs. Terms are cached based on interface langauge (e.g. langA)
2. Open translations form. Data is get based on interface language (in most cases the same as in point 1.). So you create translation to langB, but you see term labels in langA.

What can be done is to change caching strategy from interface to content. So change this:

$this->contexts = ['languages:language_interface', 'user.roles'];

into this:

$this->contexts = array_merge(['languages:' . LanguageInterface::TYPE_CONTENT, 'user.roles']);

Terms are content, not interface. They should take into account content langauge, not interface langauge.

Proposed patch provides this change.

gugalamaciek’s picture

Status: Active » Needs review
joseph.olstad’s picture

Version: 8.x-1.x-dev » 2.0.x-dev

This patch still applies cleanly to 2.0.x

With that said, does this patch work with AND without translation?

gugalamaciek’s picture

I prepared MR for 3.0.x which adds tests as well.

joseph.olstad’s picture

Status: Needs review » Fixed

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.