diff --git a/i18n_node/i18n_node.install b/i18n_node/i18n_node.install index 7622bcf..7752cbf 100644 --- a/i18n_node/i18n_node.install +++ b/i18n_node/i18n_node.install @@ -53,12 +53,3 @@ function i18n_node_update_7000() { i18n_string_install_update_context('nodetype:type:*:*', 'node:type:*:*'); i18n_string_install_update_context('node:type:*:title', 'node:type:*:title_label'); } - -/** - * Delete obsoleted variable for switch interface for translating. - */ -/* -function i18n_node_update_7001() { - variable_del('i18n_node_translation_switch'); -} -*/ diff --git a/i18n_node/i18n_node.pages.inc b/i18n_node/i18n_node.pages.inc index 34cbe4b..5b21f4d 100644 --- a/i18n_node/i18n_node.pages.inc +++ b/i18n_node/i18n_node.pages.inc @@ -110,15 +110,18 @@ function i18n_node_translation_overview($node) { * Create link for node translation. This may be a 'edit' or a 'add translation' link. */ function i18n_node_translation_link($text, $path, $langcode, $options = array()) { - $type = variable_get('translation_language_type', LANGUAGE_TYPE_INTERFACE); - $links = language_negotiation_get_switch_links($type, $path); - // When node not published, links don't have href so we use path instead - // Note: this is a bug in Core translation module, see http://drupal.org/node/1137074 - if (!empty($links->links[$langcode]) && !empty($links->links[$langcode]['href'])) { - $options += array('attributes' => array(), 'html' => FALSE); - $options['attributes'] += $links->links[$langcode]['attributes']; - $options += $links->links[$langcode]; - $path = $links->links[$langcode]['href']; + // We may want to switch interface for translation (core default) or not + if (variable_get_value('i18n_node_translation_switch')) { + $type = variable_get('translation_language_type', LANGUAGE_TYPE_INTERFACE); + $links = language_negotiation_get_switch_links($type, $path); + // When node not published, links don't have href so we use path instead + // Note: this is a bug in Core translation module, see http://drupal.org/node/1137074 + if (!empty($links->links[$langcode]) && !empty($links->links[$langcode]['href'])) { + $options += array('attributes' => array(), 'html' => FALSE); + $options['attributes'] += $links->links[$langcode]['attributes']; + $options += $links->links[$langcode]; + $path = $links->links[$langcode]['href']; + } } return l($text, $path, $options); } @@ -353,4 +356,4 @@ function theme_i18n_node_select_translation($variables) { $output .= drupal_render_children($elements); } return $output; -} +} \ No newline at end of file diff --git a/i18n_node/i18n_node.variable.inc b/i18n_node/i18n_node.variable.inc index 9362fc3..db6edcc 100644 --- a/i18n_node/i18n_node.variable.inc +++ b/i18n_node/i18n_node.variable.inc @@ -28,6 +28,13 @@ function i18n_node_variable_info($options = array()) { 'default' => 0, 'group' => 'i18n_node', ); + $variables['i18n_node_translation_switch'] = array( + 'type' => 'boolean', + 'title' => t('Switch interface for translating', array(), $options), + 'default' => 1, + 'group' => 'i18n_node', + 'description' => t('Switch interface language to fit node language when creating or editing a translation. If not checked the interface language will be independent from node language. This may have some unintended effects like references not matching the node language.', array(), $options), + ); $variables['i18n_node_default_language_none'] = array( 'title' => t('Default language for content types with Multilingual support disabled.', array(), $options), 'description' => t('Determines which language will be set for newly created content of types that don\'t have Multilingual support enabled.', array(), $options),