views:

480

answers:

1

I have multi-language website in Drupal, but not all content is translated. I want the language switcher block to appear in a content page only if there's a translation for that content.

The language switcher block uses the function translation_path_get_translations to get the path of the translated version of the content being viewed. If there's no translated paths, the block does not print the switcher.

The problem is that sometimes the translated version is under the same path that the original content (e.g. when it's a view or a module-generated content). In this case, although translation_path_get_translations doesn't return any translated path, the language switcher should be printed, because the view or module will take care of the translation.

For example, these are the paths of a translated content:

english/content-path-here
portuguese/conteudo-aqui

And these are paths of a content generated by a view or module:

english/foobar
portuguese/foobar

So, is there a way to solve this? Maybe a way to determine if a given path is a "real content" (and not a view/module)?

Thanks.

+2  A: 
Nikit
Thanks! Not a perfect solution, but works in my project :)
Vinicius Pinto