Index: l10n_community/extractor.inc =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/Attic/extractor.inc,v retrieving revision 1.1.2.13.2.6 diff -u -p -r1.1.2.13.2.6 extractor.inc --- l10n_community/extractor.inc 19 Sep 2009 09:19:17 -0000 1.1.2.13.2.6 +++ l10n_community/extractor.inc 20 Oct 2009 15:50:27 -0000 @@ -187,6 +187,15 @@ function l10n_community_save_string($val $files[$file] = l10n_community_save_file(NULL, $file); } + // Value set but empty. Mark error on empty translatable string. Only trim + // for empty string checking, since we should store leading/trailing + // whitespace as it appears in the string otherwise. + $check_empty = trim($value); + if (empty($check_empty)) { + potx_status('error', t('Empty string attempted to be localized. Please do not leave test code for localization in your source.'), $file, $line); + return; + } + // If we have the file entry now, we can process adding the string. if (isset($files[$file])) { // Explode files array to pid, rid and fid. Index: l10n_community/tests/l10n_community.test =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/l10n_server/l10n_community/tests/Attic/l10n_community.test,v retrieving revision 1.1.2.11 diff -u -p -r1.1.2.11 l10n_community.test --- l10n_community/tests/l10n_community.test 20 Oct 2009 13:10:42 -0000 1.1.2.11 +++ l10n_community/tests/l10n_community.test 20 Oct 2009 15:50:27 -0000 @@ -49,6 +49,9 @@ class L10nServerTestCase extends DrupalW $this->assertText(t('The configuration options have been saved.'), t('Local package directory set.')); $this->project_names = array(); + + // Store empty error message for reuse in multiple cases. + $this->empty_error = t('Empty string attempted to be localized. Please do not leave test code for localization in your source.'); } /** @@ -226,6 +229,18 @@ class L10nServerTestCase extends DrupalW $this->assertRaw(''. $this->project_names[5] .': 5.x-'. $this->version_js .' (1)'); $this->assertRaw(''. $this->project_names[6] .': 6.x-'. $this->version_js .' (1), 6.x-'. $this->version_base .' (1)'); $this->assertRaw(''. $this->project_names[7] .': 7.x-'. $this->version_js .' (1)'); + + // WARNINGS ==== + + // 3 in the module. + $this->drupalGet('translate/projects/'. $this->project_names[5] .'/warnings'); + $this->assertCount($this->empty_error, 3, t('3 warnings found in Drupal 5 project releases.')); + // 3 in both releases of modules, 1 in the JS (in one release). + $this->drupalGet('translate/projects/'. $this->project_names[6] .'/warnings'); + $this->assertCount($this->empty_error, 7, t('7 warnings found in Drupal 5 project releases.')); + // 2 in the module, 1 in the JS. + $this->drupalGet('translate/projects/'. $this->project_names[7] .'/warnings'); + $this->assertCount($this->empty_error, 3, t('3 warnings found in Drupal 5 project releases.')); } /**