Conflict with locale.inc
igor.ro - August 28, 2009 - 11:46
| Project: | jQuery Compatibility Mode |
| Version: | 6.x-1.5 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
Description
When we enable locale.module it runs locale_update_js_files() function to apply actual language to all js files.
This module uses Locale.inc and have conflict with this jquery_compatebility_mode module.
locale.module contains such code
// The first three parameters are NULL in order to get an array with all
// scopes. This is necessary to prevent recreation of JS translation files
// when new files are added for example in the footer.
$javascript = drupal_add_js(NULL, NULL, NULL);
$files = $new_files = FALSE;
foreach ($javascript as $scope) {
foreach ($scope as $type => $data) {
if ($type != 'setting' && $type != 'inline') {
foreach ($data as $filepath => $info) {
$files = TRUE;
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);
watchdog('locale', 'Parsed JavaScript file %file.', array('%file' => $filepath));
$parsed[] = $filepath;
$new_files = TRUE;
}
}
}
}
}
}because we override drupal_add_js
this sting gets wrong path to files.
$javascript = drupal_add_js(NULL, NULL, NULL);For example it returns such path /jquery_compatibility_mode/sites/all/modules/custom/test_module/test_module.js
But realy this file have such path /sites/all/modules/custom/test_module/test_module.js
locale_inc_callback('_locale_parse_js_file', $filepath);this function gets js file content by fread function. And because of wrong path we have error.

#1
Here is a module that fixes this bug.
#2
#3
Hmmm I will add this to the project as an addon module and a check in the main module to enable/disable it whenever it notices the locale module running.
#4
This is now an addon module that enables and disables itself whenever the locale module is enabled/disabled. Thanx for the submission. The new addon module is in the 6-1-6 release (v 1.6)