Index: locale.module =================================================================== RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v retrieving revision 1.212.2.2 diff -u -8 -p -u -p -r1.212.2.2 locale.module --- locale.module 9 Jul 2008 21:48:28 -0000 1.212.2.2 +++ locale.module 22 Sep 2008 09:27:11 -0000 @@ -307,16 +307,30 @@ function locale_form_alter(&$form, $form function locale_theme() { return array( 'locale_languages_overview_form' => array( 'arguments' => array('form' => array()), ), ); } +/** + * Implementation of hook_file_download(). + * + * Ensure that translation JS are always downloadable. + */ +function locale_file_download($file) { + $path = file_create_url(variable_get('locale_js_directory', 'languages')); + $path = substr($path, strlen($GLOBALS['base_url']) + 1); + + if (strpos($file, $path) === 0) { + return array('Content-type: application/x-javascript'); + } +} + // --------------------------------------------------------------------------------- // Locale core functionality /** * Provides interface translation services. * * This function is called from t() to translate a string if needed. * @@ -493,17 +507,19 @@ function locale_system_update($component * This function checks all JavaScript files currently added via drupal_add_js() * and invokes parsing if they have not yet been parsed for Drupal.t() * and Drupal.formatPlural() calls. Also refreshes the JavaScript translation * file if necessary, and adds it to the page. */ function locale_update_js_files() { global $language; - $dir = file_create_path(variable_get('locale_js_directory', 'languages')); + $dir = file_create_url(file_create_path(variable_get('locale_js_directory', + 'languages'))); + $dir = substr($dir, strlen($GLOBALS['base_url']) + 1); $parsed = variable_get('javascript_parsed', array()); // 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;