I build a multilingual site. The default language is EN and NL and FR is used too. I have several views which list different content types. These are created in English and then translated to the other languages using configuration translation.

The path alias for the content types is 'view-path'/[node:title] ('view-path' is added manually as a string, not using tokens, eg. products/[node:title]).

When I switch the language, the view title segment keeps its language, not changes to the selected language. (Eg if it was NL it keeps to be the NL translation regardless the language switch.) I have to empty the cache after switching language to see the right translation.

It may be something related to core because I have a similar experience with admin menu items.

Additional information (I do not think it should be related but may be useful):

  • The site uses the language_access module to hide EN lang from non-admin users.
  • The page title block is hidden on the view pages.

Comments

thamas created an issue. See original summary.

thamas’s picture

Title: Segment translation is cached and not changin when swithcing language » Segment translation is cached and not changing when swithcing language
imre.horjan’s picture

Assigned: Unassigned » imre.horjan
Status: Active » Needs review
StatusFileSize
new789 bytes

Let's try using languages as a cache context.

Status: Needs review » Needs work
imre.horjan’s picture

Status: Needs work » Needs review
StatusFileSize
new699 bytes
greg boggs’s picture

Nice! After 3 years, I think we've finally got cache expiration working as expected.

tatarbj’s picture

woohoo, Hungarian spirit \o/

tatarbj’s picture

Assigned: imre.horjan » Unassigned
Status: Needs review » Reviewed & tested by the community

I've tested the given scenario and with the applied patch on 8.x-1.x-dev I didn't have to clear the cache to get the correct segment.
For me it's ready to be committed - maybe some further manual tests are needed also would be nice to have some coverage in the tests for it, but maybe in a follow-up it makes more sense.

Bests,
Balazs.

imre.horjan’s picture

Assigned: Unassigned » imre.horjan
Status: Reviewed & tested by the community » Needs work

Thanks for your feedback.

We've done some manual testing with heavy caching, and didn't solve the problem in our use case.
Let me dig deeper, maybe I can find anything else to fix this.
In our use case the parent page is a views page, while the sub page is a node page.

tatarbj’s picture

Awesome, thanks for stepping up!

imre.horjan’s picture

Assigned: imre.horjan » Unassigned
Status: Needs work » Reviewed & tested by the community

I've tested again, and it seems to work. Maybe I did something wrong while testing (or my browser's cache tricked me).
Putting back to RTBC.

diamondsea’s picture

Title: Segment translation is cached and not changing when swithcing language » Segment translation is cached and not changing when switching language

fix title typo

  • diamondsea committed 2d860f5 on 8.x-1.x authored by imre.horjan
    Issue #3029117 by imre.horjan, thamas, tatarbj, diamondsea, Greg Boggs:...
diamondsea’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.