Drupal: displaying a language switcher only when the content is translated

danielsdem

New Member
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 \[code\]translation_path_get_translations\[/code\] 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 \[code\]translation_path_get_translations\[/code\] 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:\[code\]english/content-path-hereportuguese/conteudo-aqui\[/code\]And these are paths of a content generated by a view or module:\[code\]english/foobarportuguese/foobar\[/code\]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.
 
Back
Top