Hi,

I have a content type which the users are allow to create and translate into three different languages: Language A, B and C. The language switcher works fine and shows when a content is not being translated at all, or is translated into all three languages. However, when the same content is translated into only one other language, the third language item in the language switcher disappear on the page that show that same exact content.

How can we make the language switcher stay at all time?

Thanks.

BB

Comments

hass’s picture

Project: Internationalization » Drupal core
Version: 6.x-1.x-dev » 6.x-dev
Component: User interface » language system
hass’s picture

Component: language system » locale.module
udig’s picture

Hi,

I noticed the switcher menu is built using hook_translation_link_alter. In order to force the menu to include all enabled languages all the time and present the homepage for the non existing pages, I used the below override:

<?php
function mymodule_translation_link_alter(&$links, $path) {
  $new_links = array();
  $languages = language_list('enabled');
  if ($paths = translation_path_get_translations($path)) {
    foreach($languages[1] as $langcode => $language){
      $new_links[$langcode] = array(
        'href'       => (isset($paths[$langcode]))? $paths[$langcode] : '' ,
        'title'      => $language->native,
        'language'   => $language,
        'attributes' => array('class' => 'language-link'),
      );
    }
    $links = $new_links;
  }
}
?>

Not sure it's the No. 1 correct way of doing it but it works.

ressa’s picture

I actually like that language switcher links to untranslated pages disappear, and would like to hide them altogether.
Or maybe include a setting somewhere, to either hide or show links to non-translated pages, in the language switcher box?

blueblade’s picture

It's my personal preference but I think having the language links in the switcher box disappear is confusing to the users. The links in the switcher box should always show and clickable, the user can see the content in whatever language it is written in but the labels etc on the site should be shown in the selected language.

escoles’s picture

Our client requires that the language switcher not be visible if there is no translation.

In my opinion, it's more confusing for the switcher to appear if there is no translation. Here's the use-case:

  1. Non-English-speaking, Chinese-speaking user visits site, sees "简体中文" in the header.
  2. User clicks on "简体中文" expecting to get translated page.
  3. User gets English page.

That having been said: What's the status of this? Because as I sit here, the switcher is appearing on all pages, regardless of the translation status of the node. (D6.15)

And: This issue seems to be conflating interface translation and content translation.

johannesdr’s picture

I am having the same issue. But in my case the language links to untranslated nodes should not be shown.

I think the following issues are all related. But it looks like the behavior differs in many cases:

It was fixed for Drupal 7 by adding a 'locale-untranslated' class:
#518364: Nodes with one language don't affect the language switcher block
Perhaps this should be backported to D6?

andrew answer’s picture

The correct way how language switcher should work IMHO:
1) do not link any page to itself (English page shouldn't have link to English translation, but should have simple text instead of disappearing menu item) - it confuse users and search engines too.
2) if some page haven't translation yet - don't show link but place simple text instead with title (appear on hover) "you haven't [lang] translation yet". Users will have consistent UI and no 404 page needed (like module translation404 do); search engines mark links which go to 404 page as wrong.
Such way we will have friendly UI for users and bots :)

kououken’s picture

Ah.. already fixed for D7. :) Would like to see a backport to 6 definitely!

Status: Active » Closed (outdated)

Automatically closed because Drupal 6 is no longer supported. If the issue verifiably applies to later versions, please reopen with details and update the version.