Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 293522

Fields row plugin: Translation is non-uniform for base fields, Field UI fields, links; no way to choose "this row's language"

$
0
0

Note: This is now part of the master plan on #2313159: [meta] Make multilingual views work

Problem/Motivation

Views with row plugin "Fields" are inconsistent about the language that is used for display.

Steps to reproduce

a) Install with Standard install profile.

b) Turn on Content Translation module and its dependencies, like Language.

c) Add Spanish language (or whatever language you want)

d) Go to admin/config/regional/content-language

e) Turn on "Content" as having custom settings, and enable translation for Article content type. Make sure both Title and Body are checked as translatable.

f) Add an Article node in English, with title/body set to "Food in Paris".

g) Translate this into Spanish, as "Comida en Paris".

h) Add a new View of Article content, without filtering beyond published and content type.

i) Make the view use the Fields row plugin, and display the Title, Body, View link, and Edit link.

What should happen

If instead of using the Field row plugin, you use the Entity View Mode row plugin, things are fine. For instance, if you choose Teasers and "Translation Language" for the language option, you will see the English and Spanish translations of the title and body; and the title, edit, and translate links will be going to appropriate language-specific URLs. This is good. Screen shot from March:
teaser view
(Note: This looks slightly different now because there are some contextual links included, but the translations are still fine and link URLs are correct, as of Oct 17 2014.)

You can also choose "original language", which will display both rows in English, or "current language" (which is really "the selected/detected Content language"), which will also display both rows in English.

What does happen

One output row will show the node title, links, and body in English, which is fine. The other row of output will have the node title in Spanish but linked to the English URL; the node body in English; the links for edit and view going to the English URLs. Here's a screen shot showing the title and body at least:
field view
Also, if you are viewing your site in Spanish, the same thing happens -- you will still get the English body.

The current reason for this is that there is a setting under "Advanced" in the Views UI, for each Display, called "Field language". It gives you the usual language choices, and says it governs the language used for all fields. The default is "Current users language", which actually means the language chosen by the language switcher and/or language negotiation settings. This is why my Body fields are being shown in English. But the Title is displaying in Spanish, so they do not obey this setting.

And there is no way to specify, as you can for Entity View Mode row plugins, "Display each row in the translation that that row represents", or "Display each row in the original language for the entity".

Proposed resolution

Currently, we have a setting for Entity display language that is on the Entity row plugin, and a setting for Field display language that is at the display level and applies to the Fields row plugin and possibly to the Table style plugin (which doesn't use a row plugin).

These settings should be unified, and so they need to be on the Display plugin, because some need to apply to Row plugins (Field, Entity) and some to Style plugins (like Table). And anywhere entities are displayed, they need to be translated into this language first, and the links and base fields and regular fields and complete entities and whatever else needs to be displayed using that language.

And the language settings should give you options for:
- The detected/selected content language for the page the view is displayed on
- The translation language (language of the row)
- The original language of each entity in the row
- Specific languages (English, Spanish, etc. - whatever is on your site)
- Site default language

Currently, Field settings give you specific and site default language options, and Entity settings give you the other 3. Both should allow both.

Remaining tasks

- Set up the unified display setting for language, with unified list of options.
- Remove existing settings.
- Make existing row/style plugins obey this setting.
- Tests

User interface changes

- New unified setting at the Display level for dsiplay language.
- Remove existing Field Language Display setting in Advanced and Entity display language setting on the Entity row plugin.
- Field, link, and entity view mode languages will behave consistently in views rendering, no matter which style/row plugins are being used.

API changes

Some views settings will move.


Viewing all articles
Browse latest Browse all 293522

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>