summaryrefslogtreecommitdiff
path: root/modules/translation
diff options
context:
space:
mode:
authorDries Buytaert <dries@buytaert.net>2010-07-17 11:31:36 +0000
committerDries Buytaert <dries@buytaert.net>2010-07-17 11:31:36 +0000
commit67317ecc01211d791697dfce662346ab621a31e3 (patch)
tree40396e4c9331f84cc5b06fea9bfe5a206da358a8 /modules/translation
parent7175aab4f9a7740c2657341fe249b3a4b16abcfa (diff)
downloadbrdo-67317ecc01211d791697dfce662346ab621a31e3.tar.gz
brdo-67317ecc01211d791697dfce662346ab621a31e3.tar.bz2
- Patch #784832 by plach: fixed conflict with the session language provider while creating a translation.
Diffstat (limited to 'modules/translation')
-rw-r--r--modules/translation/translation.module11
-rw-r--r--modules/translation/translation.pages.inc2
-rw-r--r--modules/translation/translation.test4
3 files changed, 9 insertions, 8 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;
diff --git a/modules/translation/translation.pages.inc b/modules/translation/translation.pages.inc
index 70fa7fd10..5c6add4b6 100644
--- a/modules/translation/translation.pages.inc
+++ b/modules/translation/translation.pages.inc
@@ -47,7 +47,7 @@ function translation_node_overview($node) {
// No such translation in the set yet: help user to create it.
$title = t('n/a');
if (node_access('create', $node)) {
- $options[] = l(t('add translation'), 'node/add/' . str_replace('_', '-', $node->type), array('query' => array('translation' => $node->nid, 'language' => $language->language)));
+ $options[] = l(t('add translation'), 'node/add/' . str_replace('_', '-', $node->type), array('query' => array('translation' => $node->nid, 'target' => $language->language)));
}
$status = t('Not translated');
}
diff --git a/modules/translation/translation.test b/modules/translation/translation.test
index ffcbd5466..d72fd390a 100644
--- a/modules/translation/translation.test
+++ b/modules/translation/translation.test
@@ -53,7 +53,7 @@ class TranslationTestCase extends DrupalWebTestCase {
// Attempt to submit a duplicate translation by visiting the node/add page
// with identical query string.
$languages = language_list();
- $this->drupalGet('node/add/page', array('query' => array('translation' => $node->nid, 'language' => 'es')));
+ $this->drupalGet('node/add/page', array('query' => array('translation' => $node->nid, 'target' => 'es')));
$this->assertRaw(t('A translation of %title in %language already exists', array('%title' => $node_title, '%language' => $languages['es']->name)), t('Message regarding attempted duplicate translation is displayed.'));
// Attempt a resubmission of the form - this emulates using the back button
@@ -154,7 +154,7 @@ class TranslationTestCase extends DrupalWebTestCase {
* @param string $language Language code.
*/
function createTranslation($node, $title, $body, $language) {
- $this->drupalGet('node/add/page', array('query' => array('translation' => $node->nid, 'language' => $language)));
+ $this->drupalGet('node/add/page', array('query' => array('translation' => $node->nid, 'target' => $language)));
$body_key = "body[$language][0][value]";
$this->assertFieldByXPath('//input[@id="edit-title"]', $node->title, "Original title value correctly populated.");