Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
The entity_translation_languages()
function should inherit the i18n language settings, in the case the entity at hand is a node and the i18n_node module is enabled.
There is some suggested code for that here #2339495-4: English language appears in list even if it is disabled and this issue should take care of implementing this functionality in the form of a proper patch.
And yes, this all started with a @todo :-)
/**
* Returns the set of languages available for translations.
*/
function entity_translation_languages($entity_type = NULL, $entity = NULL) {
if (isset($entity) && $entity_type == 'node' && module_exists('i18n_node')) {
// @todo Inherit i18n language settings.
}
elseif (variable_get('entity_translation_languages_enabled', FALSE)) {
$languages = language_list('enabled');
return $languages[1];
}
return language_list();
}
Comments
Comment #2
stefanos.petrakis@gmail.com