Index: modules/locale/locale.module =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v retrieving revision 1.283 diff -u -p -r1.283 locale.module --- modules/locale/locale.module 19 Feb 2010 10:38:31 -0000 1.283 +++ modules/locale/locale.module 22 Feb 2010 03:02:56 -0000 @@ -273,16 +273,6 @@ function locale_init() { } /** - * Wrapper function to be able to set callbacks in locale.inc - */ -function locale_inc_callback() { - $args = func_get_args(); - $function = array_shift($args); - include_once DRUPAL_ROOT . '/includes/locale.inc'; - return call_user_func_array($function, $args); -} - -/** * Implements hook_permission(). */ function locale_permission() { @@ -766,6 +756,9 @@ function locale_js_alter(&$javascript) { $parsed = variable_get('javascript_parsed', array()); $files = $new_files = FALSE; + // Could be called from simpletest without locale_init(). + require_once DRUPAL_ROOT . '/includes/locale.inc'; + foreach ($javascript as $item) { if ($item['type'] == 'file') { $files = TRUE; @@ -773,7 +766,7 @@ function locale_js_alter(&$javascript) { if (!in_array($filepath, $parsed)) { // Don't parse our own translations files. if (substr($filepath, 0, strlen($dir)) != $dir) { - locale_inc_callback('_locale_parse_js_file', $filepath); + _locale_parse_js_file($filepath); $parsed[] = $filepath; $new_files = TRUE; } @@ -785,14 +778,14 @@ function locale_js_alter(&$javascript) { // JavaScript translation files for all languages, adding the refresh // flags into the existing array. if ($new_files) { - $parsed += locale_inc_callback('_locale_invalidate_js'); + $parsed += _locale_invalidate_js(); } // If necessary, rebuild the translation file for the current language. if (!empty($parsed['refresh:' . $language->language])) { // Don't clear the refresh flag on failure, so that another try will // be performed later. - if (locale_inc_callback('_locale_rebuild_js')) { + if (_locale_rebuild_js()) { unset($parsed['refresh:' . $language->language]); } // Store any changes after refresh was attempted. Index: modules/locale/locale.test =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.test,v retrieving revision 1.62 diff -u -p -r1.62 locale.test --- modules/locale/locale.test 30 Jan 2010 07:59:25 -0000 1.62 +++ modules/locale/locale.test 22 Feb 2010 03:02:57 -0000 @@ -334,7 +334,8 @@ class LocaleTranslationFunctionalTest ex $this->drupalPost($url, $edit, t('Save translations')); // Trigger JavaScript translation parsing and building. - locale_inc_callback('_locale_rebuild_js', $langcode); + require_once DRUPAL_ROOT . '/includes/locale.inc'; + _locale_rebuild_js($langcode); // Retrieve the JavaScript translation hash code for the custom language to // check that the translation file has been properly built. @@ -350,7 +351,7 @@ class LocaleTranslationFunctionalTest ex file_unmanaged_delete($js_file); $this->assertTrue($result = !file_exists($js_file), t('JavaScript file deleted: %file', array('%file' => $result ? $js_file : t('found')))); cache_clear_all(); - locale_inc_callback('_locale_rebuild_js', $langcode); + _locale_rebuild_js($langcode); $this->assertTrue($result = file_exists($js_file), t('JavaScript file rebuilt: %file', array('%file' => $result ? $js_file : t('not found')))); } @@ -1534,7 +1535,7 @@ class UILanguageNegotiationTest extends $language_domain = 'example.cn'; // Setup the site languages by installing two languages. - require_once('includes/locale.inc'); + require_once DRUPAL_ROOT . '/includes/locale.inc'; locale_add_language($language_browser_fallback); locale_add_language($language); Index: modules/field/tests/field.test =================================================================== RCS file: /cvs/drupal/drupal/modules/field/tests/field.test,v retrieving revision 1.18 diff -u -p -r1.18 field.test --- modules/field/tests/field.test 12 Feb 2010 05:38:10 -0000 1.18 +++ modules/field/tests/field.test 22 Feb 2010 03:02:57 -0000 @@ -2576,8 +2576,9 @@ class FieldTranslationsTestCase extends field_create_instance($instance); $this->instance = field_read_instance('test_entity', $this->field_name, 'test_bundle'); + require_once DRUPAL_ROOT . '/includes/locale.inc'; for ($i = 0; $i < 3; ++$i) { - locale_inc_callback('locale_add_language', 'l' . $i, $this->randomString(), $this->randomString()); + locale_add_language('l' . $i, $this->randomString(), $this->randomString()); } }