diff --git a/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php b/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php index 8aa109a..2e85afa 100644 --- a/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php +++ b/core/modules/locale/lib/Drupal/locale/Tests/LocaleCompareTest.php @@ -54,19 +54,18 @@ class LocaleCompareTest extends WebTestBase { $this->assertEqual($projects['locale_test']['info']['interface translation server pattern'], 'core/modules/locale/test/modules/locale_test/%project-%version.%language.po', 'Interface translation parameter found in project info.'); $this->assertEqual($projects['locale_test']['name'] , 'locale_test', format_string('%key found in project info.', array('%key' => 'interface translation project'))); - // Check if disabled modules are detected. + // Get the locale settings. $config = config('locale.settings'); - $config->set('translation.check_disabled_modules', TRUE); - $config->save(); + + // Check if disabled modules are detected. + $config->set('translation.check_disabled_modules', TRUE)->save(); drupal_static_reset('locale_translation_project_list'); $projects = locale_translation_project_list(); $this->assertTrue(isset($projects['locale_test_disabled']), 'Disabled module found'); // Check the fully processed list of project data of both enabled and // disabled modules. - $config = config('locale.settings'); - $config->set('translation.check_disabled_modules', TRUE); - $config->save(); + $config->set('translation.check_disabled_modules', TRUE)->save(); drupal_static_reset('locale_translation_project_list'); $projects = locale_translation_get_projects(); $this->assertEqual($projects['drupal']->name, 'drupal', 'Core project found'); diff --git a/core/modules/locale/locale.api.php b/core/modules/locale/locale.api.php index 7e9bb6a..b561ea0 100644 --- a/core/modules/locale/locale.api.php +++ b/core/modules/locale/locale.api.php @@ -83,7 +83,8 @@ * * Modules or distributions that use a dedicated translation server should use * this hook to specify the interface translation server pattern, or to add - * additional custom/non-Drupal.org modules to the distribution. + * additional custom/non-Drupal.org modules to the list of modules known to + * locale. * - "interface translation server pattern": URL of the .po translation files * used to download the files from. The URL contains tokens which will be * replaced by appropriate values. diff --git a/core/modules/locale/locale.compare.inc b/core/modules/locale/locale.compare.inc index 1b40ad4..c4b7380 100644 --- a/core/modules/locale/locale.compare.inc +++ b/core/modules/locale/locale.compare.inc @@ -37,7 +37,6 @@ function locale_translation_get_projects() { if (empty($projects)) { // Get project data from the database. - $projects = array(); // @todo: http://drupal.org/node/1627006#comment-6396658 // Specify the columns because SELECT * has bad performance on InnoDB. $result = db_query('SELECT * FROM {locale_project}'); @@ -114,6 +113,7 @@ function locale_translation_build_projects() { foreach ($project_updates[$name]['releases'] as $project_release) { // The first release with the same major release number which is not a // dev release is the one. Releases are sorted the most recent first. + // @todo http://drupal.org/node/1774024 Make a helper function. if ($project_release['version_major'] == $matches[1] && (!isset($project_release['version_extra']) || $project_release['version_extra'] != 'dev')) { $release = $project_release; @@ -140,7 +140,7 @@ function locale_translation_build_projects() { // A project can provide the path and filename pattern to download the // gettext file. Use the default if not. 'server_pattern' => isset($data['info']['interface translation server pattern']) ? $data['info']['interface translation server pattern'] : $default_server['pattern'], - 'status' => $data['project_status'] ? 1 : 0, + 'status' => !empty($data['project_status']) ? 1 : 0, ); $project = (object) $data; $projects[$name] = $project; @@ -220,11 +220,9 @@ function locale_translation_project_list() { */ function _locale_translation_prepare_project_list($data, $type) { foreach ($data as $name => $file) { - // Include interface translation projects. Custom modules can bring their - // own gettext translation file. To enable import of this file the module - // must define 'interface translation project = myproject' in its .info - // file. To allow update_process_info_list() to identify this as a project - // the 'project' property is filled with the 'interface translation project' // value. + // Include interface translation projects. To allow + // update_process_info_list() to identify this as a project the 'project' + // property is filled with the 'interface translation project' value. if (isset($file->info['interface translation project'])) { $data[$name]->info['project'] = $file->info['interface translation project']; }