Breadcrumbs are translated incorrectly.

Created on 25 November 2021, over 3 years ago
Updated 23 August 2024, 8 months ago

Problem/Motivation

Awesome that this module is now available for D8/9. I've missed it.

Not sure how well this will be accepted as an issue as I don't think Drupal core has the correct understanding of their goal to separate Interface and Content translation.

My philosophical understanding:
- the site Interface is items that an admin user would typically see; such as Edit tab, admin menu, etc.
- Content is the content on the site which would typically be visible to anonymous users.

In this regard i would classify breadcrumbs (like menu items for standard site naviagation) as Content.

But this module uses Interface language to translate; not the Content language.

This is somewhat more confusing by the fact that Drupal's default setting for this is to have Interface and Content language based on the same thing (likely URL prefix in most cases). Going with this, breadcrumbs would appear to translate correctly, unfortunately site editors are required to know all the languages on the site to edit content as the admin UI would then be in whatever language they are editing content for (not ideal).

Drupal core makes this somewhat more painful in that there is only a t() method and not one to explicitly state if translating as Interface or Content. That being said, that won't be the issue for this module as it must be coded to specifically use translation language.

As a shining example of the right way to do this; Views has a filter to base off Interface or Content language.

I suppose there could be an argument that Breadcrumbs are NOT content; but not sure that is the issue here.

Steps to reproduce

- go to admin/config/regional/language/detection and set the option to have a different Interface and Content detection method
- set the majority use case: Interface based off User preference, Content based off URL
- create a breadcrumb rule for 2 different languages
- check that breadcrumb works in lang 1 and then switch the site language. The breadcrumb language will remain the same and match whatever the user has set as their preferred language. NOTE: typically for Interface you would set first as user's preference and then as URL, this way anon users would be based off URL just as content is as they have no preference. So test above assumes authenticated.

Proposed resolution

Base breadcrumb translation off of Content language (not off Interface). There might be a (weak) argument to say this should be configurable to use Interface or Content - but i don't see the case where breadcrumbs aren't considered Content.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡¨πŸ‡¦Canada liquidcms

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024