diff options
Diffstat (limited to 'modules/translation/translation.module')
-rw-r--r-- | modules/translation/translation.module | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/modules/translation/translation.module b/modules/translation/translation.module index cb2731bd8..75b0bdede 100644 --- a/modules/translation/translation.module +++ b/modules/translation/translation.module @@ -209,7 +209,7 @@ function translation_node_prepare($node) { user_access('translate content') && // And the $_GET variables are set properly. isset($_GET['translation']) && - isset($_GET['language']) && + isset($_GET['target']) && is_numeric($_GET['translation'])) { $source_node = node_load($_GET['translation']); @@ -221,7 +221,8 @@ function translation_node_prepare($node) { } $language_list = language_list(); - if (!isset($language_list[$_GET['language']]) || ($source_node->language == $_GET['language'])) { + $langcode = $_GET['target']; + if (!isset($language_list[$langcode]) || ($source_node->language == $langcode)) { // If not supported language, or same language as source node, break. return; } @@ -229,14 +230,14 @@ function translation_node_prepare($node) { // Ensure we don't have an existing translation in this language. if (!empty($source_node->tnid)) { $translations = translation_node_get_translations($source_node->tnid); - if (isset($translations[$_GET['language']])) { - drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => $source_node->title, '%language' => $language_list[$_GET['language']]->name, '%type' => $node->type)), 'error'); + if (isset($translations[$langcode])) { + drupal_set_message(t('A translation of %title in %language already exists, a new %type will be created instead of a translation.', array('%title' => $source_node->title, '%language' => $language_list[$langcode]->name, '%type' => $node->type)), 'error'); return; } } // Populate fields based on source node. - $node->language = $_GET['language']; + $node->language = $langcode; $node->translation_source = $source_node; $node->title = $source_node->title; |