I have translated path-based meta description and keywords for my front page (path = node).

There work OK for the default site language (Greek), but for the secondary language (English) they do not show up.

Live example can be seen here:

Please advise.

CommentFileSizeAuthor
#3 metatag_quick_debug.png7.85 KBSiliconMind
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

marktheshark’s picture

Issue summary: View changes
marktheshark’s picture

Any feedback on this?

SiliconMind’s picture

Priority: Normal » Major
FileSize
7.85 KB

I've hit the same issue.
Apparently the problem is caused by the fact that the meta field was saved with language code other than LANGUAGE_NONE. It all boils down to this point inside metatags_quick_page_build() function:

if ($path_based_id > 0) {
  $controller = new DrupalDefaultEntityController('metatags_path_based');
  $path_entities = $controller->load(array($path_based_id));
  foreach ($path_entities as $entity) {
    // Source of the problem:
    field_attach_view('metatags_path_based', $entity, 'default');
  }
}

In my case some meta tags fields were saved with language 'en'. So the entity looked like this:
Language mismatch

As you can see the $entity->lang is 'sv' because it is supposed to be displayed on Swedish page. But the field language is saved as 'en'. So when you call field_attach_view('metatags_path_based', $entity, 'default'); you get nothing because languages don't match. I noticed that on my other sites field languages were saved as LANGUAGE_NONE so it works always regardless of current display language.

I don't know why my meta tags fields were saved with explicit English language code instead of universal LANGUAGE_NONE, but this shows that there is something wrong in the way translations are handled by this module.

If you create different entities for each language then you have to make sure that either their fields are saved with matching language or at least with LANGUAGE_NONE.

I'd say it's a major thing as it looks like this bug affects most multilingual sites.