From d16c8ca226525086cd44d3a98a732f0a51639863 Mon Sep 17 00:00:00 2001 From: Dave Reid Date: Tue, 9 Aug 2011 21:48:22 -0500 Subject: [PATCH] Issue #1219992: Add support for localized JavaScript strings. --- plupload.module | 16 ++++++++++++++++ plupload.pages.inc | 43 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 59 insertions(+), 0 deletions(-) create mode 100644 plupload.pages.inc diff --git a/plupload.module b/plupload.module index a37a62a..694ccb6 100644 --- a/plupload.module +++ b/plupload.module @@ -19,6 +19,17 @@ function plupload_menu() { 'access arguments' => array('Administer site configuration'), 'type' => MENU_CALLBACK, ); + + // JavaScript callback for localization strings. + if (module_exists('locale')) { + $items['plupload/i18n.js'] = array( + 'page callback' => 'plupload_output_i18n_js', + 'access callback' => TRUE, + 'type' => MENU_CALLBACK, + 'file' => 'plupload.pages.inc', + ); + } + return $items; } @@ -278,6 +289,11 @@ function plupload_library() { ))), ), ); + + if (module_exists('locale')) { + $libraries['plupload']['js'][] = url('plupload/i18n.js', array('absolute' => TRUE)); + } + return $libraries; } diff --git a/plupload.pages.inc b/plupload.pages.inc new file mode 100644 index 0000000..35a84c9 --- /dev/null +++ b/plupload.pages.inc @@ -0,0 +1,43 @@ + t('Select files'), + 'Add files to the upload queue and click the start button.' => t('Add files to the upload queue and click the start button.'), + 'Filename' => t('Filename'), + 'Status' => t('Status'), + 'Size' => t('Size'), + 'Add files' => t('Add files'), + 'Stop current upload' => t('Stop current upload'), + 'Start uploading queue' => t('Start uploading queue'), + 'Uploaded %d/%d files' => t('Uploaded %d/%d files'), + 'N/A' => t('N/A'), + 'Drag files here.' => t('Drag files here.'), + 'File extension error.' => t('File extension error.'), + 'File size error.' => t('File size error.'), + 'Init error.' => t('Init error.'), + 'HTTP Error.' => t('HTTP Error.'), + 'Security error.' => t('Security error.'), + 'Generic error.' => t('Generic error.'), + 'IO error.' => t('IO error.'), + 'Stop Upload' => t('Stop upload'), + 'Add Files' => t('Add Files'), + 'Start Upload' => t('Start upload'), + '%d files queued' => t('%d files queued'), + ); + + echo 'plupload.addI18n('; + drupal_json_output($strings); + echo ');'; + + // Allow this page to be cached. + drupal_exit(); +} -- 1.7.3.1