Commit 420b9c18 authored by Dries's avatar Dries

- Patch #332725 by andypost, Damien Tournoud, lilou, Gábor Hojtsy:...

- Patch #332725 by andypost, Damien Tournoud, lilou, Gábor Hojtsy: locale_inc_callback() is a thing of the past.
parent de8761eb
......@@ -2576,8 +2576,9 @@ class FieldTranslationsTestCase extends FieldTestCase {
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());
}
}
......
......@@ -272,16 +272,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().
*/
......@@ -766,6 +756,9 @@ function locale_js_alter(&$javascript) {
$parsed = variable_get('javascript_parsed', array());
$files = $new_files = FALSE;
// Require because locale_js_alter() could be called 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.
......
......@@ -334,7 +334,8 @@ class LocaleTranslationFunctionalTest extends DrupalWebTestCase {
$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 extends DrupalWebTestCase {
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 DrupalWebTestCase {
$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);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment