Issue #1664528 by Carl Johan: Fixed It's impossible to search for 'Strings not translated to language ...'.

merge-requests/26/head
David Rothstein 2012-07-08 23:40:47 -04:00
parent 2c7f509050
commit efe6bdfd25
2 changed files with 22 additions and 8 deletions

View File

@ -1860,7 +1860,16 @@ function _locale_translate_seek() {
}
$sql_query = db_select('locales_source', 's');
$sql_query->leftJoin('locales_target', 't', 't.lid = s.lid');
$limit_language = NULL;
if ($query['language'] != 'en' && $query['language'] != 'all') {
$sql_query->leftJoin('locales_target', 't', "t.lid = s.lid AND t.language = :langcode", array(':langcode' => $query['language']));
$limit_language = $query['language'];
}
else {
$sql_query->leftJoin('locales_target', 't', 't.lid = s.lid');
}
$sql_query->fields('s', array('source', 'location', 'context', 'lid', 'textgroup'));
$sql_query->fields('t', array('translation', 'language'));
@ -1889,12 +1898,6 @@ function _locale_translate_seek() {
break;
}
$limit_language = NULL;
if ($query['language'] != 'en' && $query['language'] != 'all') {
$sql_query->condition('language', $query['language']);
$limit_language = $query['language'];
}
// Add a condition on the text group.
if (!empty($query['group']) && $query['group'] != 'all') {
$sql_query->condition('s.textgroup', $query['group']);

View File

@ -635,7 +635,7 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$this->assertText(t('No strings available.'), t("Search didn't find the string."));
// Ensure untranslated string appears if searching on 'only untranslated
// strings'.
// strings' in "all" (hasn't been translated to any language).
$search = array(
'string' => $name,
'language' => 'all',
@ -645,6 +645,17 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
$this->assertNoText(t('No strings available.'), t('Search found the string.'));
// Ensure untranslated string appears if searching on 'only untranslated
// strings' in the custom language (hasn't been translated to that specific language).
$search = array(
'string' => $name,
'language' => $langcode,
'translation' => 'untranslated',
'group' => 'all',
);
$this->drupalPost('admin/config/regional/translate/translate', $search, t('Filter'));
$this->assertNoText(t('No strings available.'), t('Search found the string.'));
// Add translation.
// Assume this is the only result, given the random name.
$this->clickLink(t('edit'));