Problem/Motivation

There are a number of pieces of any entity formatter display that are UI text and Config text. In a View, we can have different rows displayed in different languages. However the UI text and Config text for each row is generally displayed in the page negotiated/selected UI language, not the language of this row. This could lead to a situation where you have Views output like this:

When page is viewed in English:

Title in English
Tags: Cat, Dog
Published: True
Language: English

Titulo en Espanol
Tags: Gato, Perro
Published: True
Language: Spanish

When page is viewed in Spanish:

Title in English
Etiquetas: Cat, Dog
Publicado: Cierto
Idioma: Ingles

Titulo en Espanol
Etiquetas: Gato, Perro
Publicado: Cierto
Idioma: Espanol

(sorry, I lack accents on my keyboard)

In other words, the way things are currently is that the UI and Config text, like "Tags", "Published", "True", "Language", "English" is currently displayed in the page language, while the entity information (node title and tag names) is displayed in the entity language of each views row.

This could be a bit jarring for users.

Proposed resolution

Consider whether it is desirable and feasible to make all the entity information in the views row displayed in the entity language.

Conclusion: probably not.

Remaining tasks

Depends on the decision.

User interface changes

If we decided to do this, and it was possible to accomplish, entity displays would be consistent in language in each views row.

API changes

None.

Comments

berdir’s picture

Makes sense I guess.

There's also the field definition label, which I guess has the same issue, or not? And we have no API to get that in the content language...

dawehner’s picture

Ehem right, its a general problem what is content and what is interface basically.

jhodgdon’s picture

This problem came up because I was testing #2342045: Standard views base fields need to use same rendering as Field UI fields, for formatting, access checking, and translation consistency, which is changing some Views Booleans to use Field formatters.

The Views display has a setting for the "Display language" for the entity within the row. The question is what that should do.

I guess my expectation is that all the stuff in that row of the view would be displayed in whatever the language is that is determined for that row. But maybe that expectation is flawed...

The information displayed would include:
- Which data is loaded (which translation is used to decide if a Boolean field's value is a 0 or 1, or a text field's value is "Test" in English or "Prueba" in Spanish, etc.).
- The field labels specified in the View. [But maybe these should be displayed in the UI language for the page?]
- For Boolean fields, once you've found the value, there's a formatter setting that says "1 is yes, 0 is no", or whatever. My expectation would be that these would be displayed as Si/No if the row is displaying in Spanish.
[But maybe these should be displayed in the UI language of the page? Presumably they're either config (if custom) or UI text (if a built-in alternative is chosen).]

Hm... I'm not sure really what should happen. So let's say you have a node with English and Spanish versions. The English one is Published and the Spanish one isn't. And for whatever reason, you have a view that displays the node title and the Published field (in Yes/No format).

So the question is, should it look like:

a)
My title
Published: Yes [if viewing the page in English]
Publicado: Si [if viewing the page in Spanish]

Mi titulo
Publicado: No

b)
My Title
Published: Yes

Mi Titulo
Published: No [if viewing the page in English]
Publicado: No [if viewing the page in Spanish]

And here I mean by "viewing the page in X" that you go to example.com/es/[URL] vs. just example.com/[URL] to switch the UI language.

I think that outside of Views, on most sites, this isn't a problem, because normally the Content language is the same as the UI language on a given page (same negotiated/selected language criteria), so normally the content and the field titles and the formatter config is all being displayed in the same language. But in the case of Views, you can have multiple translations being displayed in the same view, so we have to think about what should happen in this case.

I'm not sure what the right answer is... and probably didn't need to add this overly verbose comment to describe what you undoubtedly had already thought through. ;)

dawehner’s picture

Just to be clear, this is not an issue which just exists on the boolean formatters.
We have places like the "created by" information on nodes, date formats when rendered all falls into the same behaviour.

yched’s picture

Yeah, formatters that transform field values based on some properties held in config are problematic.

The underlying field values (0/1 for a boolean, a timestamp for a date) are the correct values for the "content language", but they are then transformed (to "Yes/no" strings, to date formats) using configuration that is the one for the "interface language". Depending on what the transformation does, this ends up looking slightly off or frankly broken.

Same issue for the field labels that get prepended to the displayed values.

No real suggestion atm, just trying to get a clear view of the issue. We're at the problematic intersection of content and config :-/

berdir’s picture

Slight correction...

problematic intersection of content and config *and interface* *translation*

And no, that doesn't make it easier ;)

jhodgdon’s picture

Title: Boolean formatters should render the string depending on the entity language, not the language not the current interface language. » Entity formatters should (maybe?) render UI/Config text that is part of the display using the entity language, not the current interface language
Issue summary: View changes

Yes, that is true. Adjusting title, and rewriting summary.

So I am becoming less sure whether (a) changing how this works would be a good idea and (b) if it is even practical if we decide it's a good idea. I guess it seems like kind of an edge case, but at best it would be a very complicated rewrite of the Interface, Config, and Content translation system to say "Well, in spite of the overall page language, this bit of config and this bit of UI text is part of an entity display on this page that's in a different language, so translate it to something different after all".

I think we should just close this as a Works as Designed and decide that I was being silly to bring it up on the other issue that dawehner spun this off from.

jhodgdon’s picture

Issue tags: +D8MI
jhodgdon’s picture

So... should we just close this?

Version: 8.0.x-dev » 8.1.x-dev

Drupal 8.0.6 was released on April 6 and is the final bugfix release for the Drupal 8.0.x series. Drupal 8.0.x will not receive any further development aside from security fixes. Drupal 8.1.0-rc1 is now available and sites should prepare to update to 8.1.0.

Bug reports should be targeted against the 8.1.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.9 was released on September 7 and is the final bugfix release for the Drupal 8.1.x series. Drupal 8.1.x will not receive any further development aside from security fixes. Drupal 8.2.0-rc1 is now available and sites should prepare to upgrade to 8.2.0.

Bug reports should be targeted against the 8.2.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.6 was released on February 1, 2017 and is the final full bugfix release for the Drupal 8.2.x series. Drupal 8.2.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.3.0 on April 5, 2017. (Drupal 8.3.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.3.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.6 was released on August 2, 2017 and is the final full bugfix release for the Drupal 8.3.x series. Drupal 8.3.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.4.0 on October 4, 2017. (Drupal 8.4.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.4.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.4 was released on January 3, 2018 and is the final full bugfix release for the Drupal 8.4.x series. Drupal 8.4.x will not receive any further development aside from critical and security fixes. Sites should prepare to update to 8.5.0 on March 7, 2018. (Drupal 8.5.0-alpha1 is available for testing.)

Bug reports should be targeted against the 8.5.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.8.x-dev

Drupal 8.6.x will not receive any further development aside from security fixes. Bug reports should be targeted against the 8.8.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.9.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.7 was released on June 3, 2020 and is the final full bugfix release for the Drupal 8.8.x series. Drupal 8.8.x will not receive any further development aside from security fixes. Sites should prepare to update to Drupal 8.9.0 or Drupal 9.0.0 for ongoing support.

Bug reports should be targeted against the 8.9.x-dev branch from now on, and new development or disruptive changes should be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 8.9.x-dev » 9.2.x-dev

Drupal 8 is end-of-life as of November 17, 2021. There will not be further changes made to Drupal 8. Bugfixes are now made to the 9.3.x and higher branches only. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.2.x-dev » 9.3.x-dev
catch’s picture

Status: Active » Closed (works as designed)
Issue tags: +Bug Smash Initiative

Going to close this as works as designed, seven years after that was proposed as the solution.