Now that #867114: Search results should add lang tag if language of search result differs got committed, shouldn't we apply this logic to node teasers as well? For example, the list of nodes on the frontpage?

Use case:
- Add another language to the site, eg Dutch
- Create a few nodes: Dutch, English and undefined
- View the frontpage. No language switching in the HTML. Not good?

Current:

<div typeof="sioc:Item foaf:Document" about="/drupal7/node/3" class="node node-article node-promoted node-teaser contextual-links-region clearfix" id="node-3">
  <h2 datatype="" property="dc:title"><a href="/drupal7/node/3">Nederlands bericht</a></h2>
  <div class="content clearfix">
    <div class="field field-name-body field-type-text-with-summary field-label-hidden">
      <div class="field-items"><div property="content:encoded" class="field-item even">
        <p>Nederlandse tekst</p>
      </div>
    </div>
  </div>
</div>

Should be:

<div typeof="sioc:Item foaf:Document" about="/drupal7/node/3" class="node node-article node-promoted node-teaser contextual-links-region clearfix" id="node-3">
  <h2 datatype="" property="dc:title"><a href="/drupal7/node/3" xml:lang="nl">Nederlands bericht</a></h2>
  <div class="content clearfix" xml:lang="en">
    <div class="field field-name-body field-type-text-with-summary field-label-hidden">
      <div class="field-items">
        <div property="content:encoded" class="field-item even">
          <p>Nederlandse tekst</p>
        </div>
      </div>
    </div>
  </div>
</div>

Comments

Everett Zufelt’s picture

Version: 7.0-rc1 » 8.x-dev
Category: bug » feature

I agree that we should do this. However, it sounds like a feature request for D8. It should likely be able to be backported to D7.

mgifford’s picture

Agreed. I'm also linking this back to http://groups.drupal.org/node/145894 where a few of these cases are being discussed.

Jeff Burnz’s picture

Shouldn't the language attribute be on the node wrapper first, then on each field?

Thinking about the hierarchy here: page -> node -> field

Mike, isn't #1164926 a strait dup of this?

mgifford’s picture

Status: Active » Closed (duplicate)

We might want to just build a meta issue to look to see that this is handled in a consistent way. it's going to have to get input from Gabor/Jose as well I expect.

It's interesting though in the example provided the title was actually defined differently than the body. I don't know how this type of flexibility could be expressed effectively through the UI though.

Yes, this is probably a dup. I wasn't thinking about how the teasers were generated just that this was referencing the teasers & not full nodes.
#1164926: Nodes need to have languages specified separately for accessibility