Ticket #4559: js-i18n.diff
File js-i18n.diff, 34.2 KB (added by , 16 years ago) |
---|
-
wp-includes/js/wp-ajax.js
3 3 Object.extend(WPAjax.prototype, { 4 4 WPComplete: false, // onComplete function 5 5 WPError: false, // onWPError function 6 defaultUrl: '', // We get these from WPAjaxL10n7 permText: '',8 strangeText: '',9 whoaText: '',10 6 11 7 initialize: function(url, responseEl) { 12 8 var tempObj = this; … … 23 19 tempObj.WPError(transport); 24 20 } 25 21 }); 26 this.url = url ? url : this.defaultUrl;22 this.url = url ? url : WPAjaxOptions.defaultUrl; 27 23 this.getResponseElement(responseEl); 28 24 }, 29 25 addArg: function(key, value) { … … 56 52 } 57 53 var r = parseInt(r,10); 58 54 if ( -1 == r ) { 59 Element.update(this.myResponseElement,"<div class='error'><p>" + this.permText+ "</p></div>");55 Element.update(this.myResponseElement,"<div class='error'><p>" + __("You don't have permission to do that.") + "</p></div>"); 60 56 return false; 61 57 } else if ( 0 == r ) { 62 Element.update(this.myResponseElement,"<div class='error'><p>" + this.strangeText+ "</p></div>");58 Element.update(this.myResponseElement,"<div class='error'><p>" + __("Something strange happened. Try refreshing the page.") + "</p></div>"); 63 59 return false; 64 60 } 65 61 return true; … … 75 71 } 76 72 }); 77 73 78 Event.observe( window, 'load', function() { Object.extend(WPAjax.prototype, WPAjaxL10n); }, false )79 80 74 Ajax.activeSendCount = 0; 81 75 Ajax.Responders.register( { 82 76 onCreate: function() { … … 85 79 return; 86 80 wpBeforeUnload = window.onbeforeunload; 87 81 window.onbeforeunload = function() { 88 return WPAjax.whoaText;82 return __("Slow down, I'm still sending your data!"); 89 83 } 90 84 }, 91 85 onLoading: function() { // Can switch to onLoaded if we lose data -
wp-includes/js/autosave.js
5 5 var form = $('post'); 6 6 autosaveLast = form.post_title.value+form.content.value; 7 7 // Keep autosave_interval in sync with edit_post(). 8 autosavePeriodical = new PeriodicalExecuter(autosave, autosave L10n.autosaveInterval);8 autosavePeriodical = new PeriodicalExecuter(autosave, autosaveOptions.autosaveInterval); 9 9 //Disable autosave after the form has been submitted 10 10 if(form.addEventListener) { 11 11 form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false); … … 37 37 var message; 38 38 39 39 if(isNaN(res)) { 40 message = autosaveL10n.errorText.replace(/%response%/g, response);40 message = gettext.format(__('Error: {response}'), {response: response}); 41 41 } else { 42 message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time());42 message = gettext.format(__('Saved at {time}.'), {time: autosave_cur_time()}); 43 43 $('post_ID').name = "post_ID"; 44 44 $('post_ID').value = res; 45 45 // We need new nonces … … 49 49 nonceAjax.setVar("post_ID", res); 50 50 nonceAjax.setVar("cookie", document.cookie); 51 51 nonceAjax.setVar("post_type", $('post_type').value); 52 nonceAjax.requestFile = autosave L10n.requestFile;52 nonceAjax.requestFile = autosaveOptions.requestFile; 53 53 nonceAjax.onCompletion = autosave_update_nonce; 54 54 nonceAjax.method = "POST"; 55 55 nonceAjax.runAJAX(); … … 60 60 } 61 61 62 62 function autosave_loading() { 63 $('autosave').innerHTML = autosaveL10n.savingText;63 $('autosave').innerHTML = __('Saving Draft...'); 64 64 } 65 65 66 66 function autosave_saved() { … … 69 69 var message; 70 70 71 71 if(isNaN(res)) { 72 message = autosaveL10n.errorText.replace(/%response%/g, response);72 message = gettext.format(__('Error: {response}'), {response: response}); 73 73 } else { 74 message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time());74 message = gettext.format(__('Saved at {time}.'), {time: autosave_cur_time()}); 75 75 } 76 76 $('autosave').innerHTML = message; 77 77 autosave_enable_buttons(); … … 145 145 autosaveAjax.setVar("content", form.content.value); 146 146 } 147 147 148 autosaveAjax.requestFile = autosave L10n.requestFile;148 autosaveAjax.requestFile = autosaveOptions.requestFile; 149 149 autosaveAjax.method = "POST"; 150 150 autosaveAjax.element = null; 151 151 autosaveAjax.onLoading = autosave_loading; -
wp-includes/js/list-manipulation.js
1 1 addLoadEvent( function() { 2 if ( 'undefined' != typeof listManL10n )3 Object.extend(listMan.prototype, listManL10n);4 2 theList = new listMan(); 5 3 } ); 6 4 … … 8 6 if ( !obj ) 9 7 obj=theList; 10 8 if ( !message ) 11 message = obj.delText.replace(/%thing%/g, what);9 message = __('Are you sure you want to delete this {thing}').format({thing: what}); 12 10 if( confirm(message) ) 13 11 return obj.ajaxDelete( what, id ); 14 12 else return false; … … 36 34 dataStore: null, 37 35 formStore: null, 38 36 39 jumpText: '', // We get these from listManL10n40 delText: '',41 42 37 initialize: function(theListId) { 43 38 this.theList = $(theListId ? theListId : 'the-list'); 44 39 if ( !this.theList ) … … 73 68 if ( m ) 74 69 showLinkMessage += m; 75 70 else 76 showLinkMessage += "<a href='#" + what + '-' + id + "'>" + tempObj.jumpText+ "</a>";71 showLinkMessage += "<a href='#" + what + '-' + id + "'>" + __("Jump to new item") + "</a>"; 77 72 }); 78 73 if ( tempObj.showLink && showLinkMessage ) 79 74 Element.update(ajaxAdd.myResponseElement,"<div id='jumplink' class='updated fade'><p>" + showLinkMessage + "</p></div>"); -
wp-includes/js/quicktags.js
168 168 } 169 169 170 170 function edShowLinks() { 171 var tempStr = '<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>' + quicktagsL10n.quickLinks+ '</option>';171 var tempStr = '<select onchange="edQuickLink(this.options[this.selectedIndex].value, this);"><option value="-1" selected>' + __('(Quick Links)') + '</option>'; 172 172 for (i = 0; i < edLinks.length; i++) { 173 173 tempStr += '<option value="' + i + '">' + edLinks[i].display + '</option>'; 174 174 } … … 248 248 } 249 249 } 250 250 if (word == '') { 251 word = prompt( quicktagsL10n.wordLookup, '');251 word = prompt(__('Enter a word to look up:'), ''); 252 252 } 253 253 if (word !== null && /^\w[\w ]*$/.test(word)) { 254 254 window.open('http://www.answers.com/' + escape(word)); … … 260 260 for (i = 0; i < edButtons.length; i++) { 261 261 edShowButton(edButtons[i], i); 262 262 } 263 document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="' + quicktagsL10n.dictionaryLookup + '" value="' + quicktagsL10n.lookup+ '" />');264 document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="' + quicktagsL10n.closeAllOpenTags + '" value="' + quicktagsL10n.closeTags+ '" />');263 document.write('<input type="button" id="ed_spell" class="ed_button" onclick="edSpell(edCanvas);" title="' + __('Dictionary lookup').attribute_escape() + '" value="' + __('lookup').attribute_escape() + '" />'); 264 document.write('<input type="button" id="ed_close" class="ed_button" onclick="edCloseAllTags();" title="' + __('Close all open tags').attribute_escape() + '" value="' + __('close tags').attribute_escape() + '" />'); 265 265 // edShowLinks(); // disabled by default 266 266 document.write('</div>'); 267 267 } … … 366 366 defaultValue = 'http://'; 367 367 } 368 368 if (!edCheckOpenTags(i)) { 369 var URL = prompt( quicktagsL10n.enterURL, defaultValue);369 var URL = prompt(__('Enter the URL'), defaultValue); 370 370 if (URL) { 371 371 edButtons[i].tagStart = '<a href="' + URL + '">'; 372 372 edInsertTag(myField, i); … … 378 378 } 379 379 380 380 function edInsertImage(myField) { 381 var myValue = prompt( quicktagsL10n.enterImageURL, 'http://');381 var myValue = prompt(__('Enter the URL of the image'), 'http://'); 382 382 if (myValue) { 383 383 myValue = '<img src="' 384 384 + myValue 385 + '" alt="' + prompt( quicktagsL10n.enterImageDescription, '')385 + '" alt="' + prompt(__('Enter a description of the image'), '') 386 386 + '" />'; 387 387 edInsertContent(myField, myValue); 388 388 } -
wp-includes/script-loader.php
17 17 $this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' ); 18 18 19 19 $this->add( 'quicktags', '/wp-includes/js/quicktags.js', false, '3958' ); 20 $this->localize( 'quicktags', 'quicktagsL10n', array(21 'quickLinks' => __('(Quick Links)'),22 'wordLookup' => __('Enter a word to look up:'),23 'dictionaryLookup' => attribute_escape(__('Dictionary lookup')),24 'lookup' => attribute_escape(__('lookup')),25 'closeAllOpenTags' => attribute_escape(__('Close all open tags')),26 'closeTags' => attribute_escape(__('close tags')),27 'enterURL' => __('Enter the URL'),28 'enterImageURL' => __('Enter the URL of the image'),29 'enterImageDescription' => __('Enter a description of the image')30 ) );31 32 20 $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' ); 33 21 34 22 $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20070528' ); … … 38 26 $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.1.1'); 39 27 40 28 $this->add( 'autosave', '/wp-includes/js/autosave.js', array('prototype', 'sack'), '20070306'); 41 $this-> localize( 'autosave', 'autosaveL10n', array(29 $this->addoptions( 'autosave', 'autosaveOptions', array( 42 30 'autosaveInterval' => apply_filters('autosave_interval', '120'), 43 'errorText' => __('Error: %response%'),44 'saveText' => __('Saved at %time%.'),45 31 'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 46 'savingText' => __('Saving Draft...')47 32 ) ); 48 49 33 $this->add( 'wp-ajax', '/wp-includes/js/wp-ajax.js', array('prototype'), '20070306'); 50 $this-> localize( 'wp-ajax', 'WPAjaxL10n', array(34 $this->addoptions( 'wp-ajax', 'WPAjaxOptions', array( 51 35 'defaultUrl' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php', 52 'permText' => __("You don't have permission to do that."),53 'strangeText' => __("Something strange happened. Try refreshing the page."),54 'whoaText' => __("Slow down, I'm still sending your data!")55 36 ) ); 56 57 37 $this->add( 'listman', '/wp-includes/js/list-manipulation.js', array('wp-ajax', 'fat'), '20070306' ); 58 $this->localize( 'listman', 'listManL10n', array(59 'jumpText' => __('Jump to new item'),60 'delText' => __('Are you sure you want to delete this %thing%?')61 ) );62 63 38 $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.7.1-b3'); 64 39 $this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.7.1-b3'); 65 40 $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.7.1-b3'); … … 94 69 endswitch; 95 70 if ( $man ) { 96 71 $this->add( 'dbx-admin-key', '/wp-admin/js/dbx-admin-key.js', array('dbx'), '20070417' ); 97 $this-> localize( 'dbx-admin-key', 'dbxL10n', array(72 $this->addoptions( 'dbx-admin-key', 'dbxOptions', array( 98 73 'manager' => $man, 99 'open' => __('open'),100 'close' => __('close'),101 'moveMouse' => __('click-down and drag to move this box'),102 'toggleMouse' => __('click to %toggle% this box'),103 'moveKey' => __('use the arrow keys to move this box'),104 'toggleKey' => __(', or press the enter key to %toggle% it'),105 74 ) ); 106 75 } 107 76 $this->add( 'ajaxcat', '/wp-admin/js/cat.js', array('listman'), '20070724' ); 108 $this->localize( 'ajaxcat', 'catL10n', array(109 'add' => attribute_escape(__('Add')),110 'how' => __('Separate multiple categories with commas.')111 ) );112 77 $this->add( 'ajaxlinkcat', '/wp-admin/js/link-cat.js', array('listman'), '200700601' ); 113 $this->localize( 'ajaxlinkcat', 'linkcatL10n', array(114 'add' => attribute_escape(__('Add')),115 'how' => __('Separate multiple categories with commas.')116 ) );117 78 $this->add( 'admin-categories', '/wp-admin/js/categories.js', array('listman'), '3684' ); 118 79 $this->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('listman'), '3733' ); 119 80 $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('listman'), '20070327' ); 120 81 $this->add( 'admin-users', '/wp-admin/js/users.js', array('listman'), '4583' ); 121 82 $this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' ); 122 83 $this->add( 'upload', '/wp-admin/js/upload.js', array('jquery'), '20070518' ); 123 $this->localize( 'upload', 'uploadL10n', array(124 'browseTitle' => attribute_escape(__('Browse your files')),125 'back' => __('« Back'),126 'directTitle' => attribute_escape(__('Direct link to file')),127 'edit' => __('Edit'),128 'thumb' => __('Thumbnail'),129 'full' => __('Full size'),130 'icon' => __('Icon'),131 'title' => __('Title'),132 'show' => __('Show:'),133 'link' => __('Link to:'),134 'file' => __('File'),135 'page' => __('Page'),136 'none' => __('None'),137 'editorText' => attribute_escape(__('Send to editor »')),138 'insert' => __('Insert'),139 'urlText' => __('URL'),140 'desc' => __('Description'),141 'deleteText' => attribute_escape(__('Delete File')),142 'saveText' => attribute_escape(__('Save »')),143 'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.")144 ) );145 84 } 146 85 } 147 86 … … 157 96 // Print the queue if nothing is passed. If a string is passed, print that script. If an array is passed, print those scripts. 158 97 $handles = false === $handles ? $this->queue : (array) $handles; 159 98 $handles = $this->all_deps( $handles ); 99 $this->print_scripts_l10n( array_keys($handles) ); 160 100 $this->_print_scripts( $handles ); 161 101 return $this->printed; 162 102 } … … 190 130 $src = add_query_arg('ver', $ver, $src); 191 131 $src = clean_url(apply_filters( 'script_loader_src', $src )); 192 132 echo "<script type='text/javascript' src='$src'></script>\n"; 193 $this->print_scripts_ l10n( $handle );133 $this->print_scripts_options( $handle ); 194 134 } 195 135 $this->printed[] = $handle; 196 136 } 197 137 } 198 138 } 199 139 200 function print_scripts_ l10n( $handle ) {201 if ( empty($this->scripts[$handle]-> l10n_object) || empty($this->scripts[$handle]->l10n) || !is_array($this->scripts[$handle]->l10n) )140 function print_scripts_options( $handle ) { 141 if ( empty($this->scripts[$handle]->options_object) || empty($this->scripts[$handle]->options) || !is_array($this->scripts[$handle]->options) ) { 202 142 return; 203 204 $object_name = $this->scripts[$handle]->l10n_object; 205 143 } 144 $object_name = $this->scripts[$handle]->options_object; 206 145 echo "<script type='text/javascript'>\n"; 207 146 echo "/* <![CDATA[ */\n"; 208 147 echo "\t$object_name = {\n"; 209 148 $eol = ''; 210 foreach ( $this->scripts[$handle]-> l10nas $var => $val ) {211 149 foreach ( $this->scripts[$handle]->options as $var => $val ) { 150 echo "$eol\t\t$var: \"" . js_escape( $val ) . '"'; 212 151 $eol = ",\n"; 213 152 } 214 153 echo "\n\t}\n"; … … 217 156 } 218 157 219 158 /** 159 * Removes the handle metadata of a translation key 160 * 161 * @param string key The key to be filtered 162 * @param array handles The handles whose metadata to remove 163 * @return mixed The filtered key, or false if the key doesn't 164 * containt metadata of any of the handles 165 */ 166 function filter_translation( &$handles, $key ) { 167 foreach ( $handles as $handle ) { 168 $filtered_key_parts = array(); 169 // remove |:js:handle from the back of the string 170 $handle_ok = true; 171 foreach (explode("\0", $key) as $part) { 172 $wanted_end = "|:js:$handle"; 173 $base_string_len = strlen( $part ) - strlen( $wanted_end ); 174 if ($wanted_end != substr($part, $base_string_len)) { 175 $handle_ok = false; 176 break; 177 } 178 $filtered_key_parts[] = substr($part, 0, $base_string_len); 179 } 180 if ($handle_ok) { 181 return implode("\0", $filtered_key_parts); 182 } 183 } 184 return false; 185 } 186 187 188 function print_scripts_l10n( $handles ) { 189 190 static $called = false; 191 192 //TODO: allow scripts to specify their own domain, maybe 193 $domain = 'default'; 194 $all_translations = get_translations( $domain ); 195 $js_translations = array(); 196 foreach ($all_translations as $key => $value) { 197 $filtered = $this->filter_translation($handles, $key); 198 if (false !== $filtered) { 199 $js_translations[$filtered] = $value; 200 } 201 } 202 $js_translations_jsarray = translations2js( $js_translations ); 203 204 if ($called) { 205 echo "<script type='text/javascript'>\n"; 206 echo "_l10n.add(".$js_translations_jsarray.");"; 207 echo "</script>\n"; 208 return; 209 } 210 211 $src = get_option('siteurl').'/wp-includes/js/gettext.js'; 212 echo "<script type='text/javascript' src='$src'></script>\n"; 213 echo "<script type='text/javascript'>\n"; 214 echo "// <![CDATA[\n"; 215 echo "var _siteurl = '".js_escape(get_option('siteurl'))."';\n"; 216 echo "var _translations = ".$js_translations_jsarray.";\n"; 217 echo "var _l10n = new gettext(_translations);"."\n"; 218 echo "var __ = gettext.boundmethod(_l10n, _l10n.gettext);"."\n"; 219 echo "var __n = gettext.boundmethod(_l10n, _l10n.ngettext);"."\n"; 220 echo "// ]]>\n"; 221 echo "</script>\n"; 222 $called = true; 223 } 224 225 /** 220 226 * Determines dependencies of scripts 221 227 * 222 228 * Recursively builds hierarchical array of script dependencies. Does NOT catch infinite loops. … … 267 273 } 268 274 269 275 /** 270 * Localizes a script276 * Adds options to the script. 271 277 * 272 * Localizes only if script has already been added278 * Adds options from the server-side environment to the script. 273 279 * 274 280 * @param string handle Script name 275 * @param string object_name Name of JS object to hold l10n info 276 * @param array l10n Array of JS var name => localized string 277 * @return bool Successful localization 281 * @param string object_name Name of JS object to hold options 282 * @param array options Array of JS var option => value 283 * @return bool Options added successfully 284 * 278 285 */ 279 function localize( $handle, $object_name, $l10n) {286 function addoptions( $handle, $object_name, $options ) { 280 287 if ( !isset($this->scripts[$handle]) ) 281 288 return false; 282 return $this->scripts[$handle]-> localize( $object_name, $l10n);289 return $this->scripts[$handle]->addoptions( $object_name, $options ); 283 290 } 284 291 292 285 293 function remove( $handles ) { 286 294 foreach ( (array) $handles as $handle ) 287 295 unset($this->scripts[$handle]); … … 335 343 $this->ver = false; 336 344 } 337 345 338 function localize( $object_name, $l10n) {339 if ( !$object_name || !is_array($ l10n) )346 function addoptions( $object_name, $options ) { 347 if ( !$object_name || !is_array($options) ) 340 348 return false; 341 $this-> l10n_object = $object_name;342 $this-> l10n = $l10n;349 $this->options_object = $object_name; 350 $this->options = $options; 343 351 return true; 344 352 } 345 353 } … … 378 386 $wp_scripts->add( $handle, $src, $deps, $ver ); 379 387 } 380 388 381 /** 382 * Localizes a script 383 * 384 * Localizes only if script has already been added 385 * 386 * @see WP_Script::localize() 387 */ 388 function wp_localize_script( $handle, $object_name, $l10n ) { 389 function wp_script_options( $handle, $object_name, $options ) { 389 390 global $wp_scripts; 390 if ( !is_a($wp_scripts, 'WP_Scripts') )391 return fa lse;392 393 return $wp_scripts-> localize( $handle, $object_name, $l10n);391 if( !is_a($wp_scripts, 'WP_Scripts') ) { 392 return fasle; 393 } 394 return $wp_scripts->addoptions( $handle, $object_name, $options ); 394 395 } 395 396 396 397 function wp_deregister_script( $handle ) { -
wp-includes/l10n.php
107 107 load_textdomain($domain, $mofile); 108 108 } 109 109 110 /** 111 * Returns an array with the translations from the specified gettext domain 112 */ 113 function &get_translations($domain = 'default') { 114 global $l10n; 115 116 if (isset($l10n[$domain])) { 117 $l10n[$domain]->load_tables(); 118 return $l10n[$domain]->cache_translations; 119 } else { 120 return array(); 121 } 122 } 123 110 124 ?> -
wp-settings.php
140 140 include_once(ABSPATH . WPINC . '/streams.php'); 141 141 include_once(ABSPATH . WPINC . '/gettext.php'); 142 142 require_once (ABSPATH . WPINC . '/l10n.php'); 143 require_once (ABSPATH. WPINC . '/jsgettext.php'); 143 144 144 145 if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) { 145 146 if ( defined('WP_SITEURL') ) -
wp-admin/js/upload.js
94 94 } else { 95 95 h += "<a href='#' onclick='return theFileList.cancelView();'"; 96 96 } 97 h += " title='" + this.browseTitle + "' class='back'>" + this.back+ "</a>";97 h += " title='" + __('Browse your files').attribute_escape() + "' class='back'>" + __('« Back') + "</a>"; 98 98 h += "<div id='file-title'>" 99 99 if ( 0 == this.currentImage.isImage ) 100 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle+ "'>" + this.currentImage.title + "</a></h2>";100 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + __('Direct link to file').attribute_escape() + "'>" + this.currentImage.title + "</a></h2>"; 101 101 else 102 102 h += "<h2>" + this.currentImage.title + "</h2>"; 103 103 h += " — <span>"; 104 h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + this.edit+ "</a>"104 h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + __('Edit') + "</a>" 105 105 h += "</span>"; 106 106 h += '</div>' 107 107 h += "<div id='upload-file-view' class='alignleft'>"; 108 108 if ( 1 == this.currentImage.isImage ) { 109 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle+ "'>";109 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + __('Direct link to file').attribute_escape() + "'>"; 110 110 h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 111 111 h += "</a>"; 112 112 } else … … 120 120 if ( 1 == this.currentImage.isImage ) { 121 121 checked = 'display-full'; 122 122 if ( this.currentImage.thumb ) { 123 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.thumb+ "</label><br />");123 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + __('Thumbnail') + "</label><br />"); 124 124 checked = 'display-thumb'; 125 125 } 126 display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> " + this.full+ "</label>");126 display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> " + __('Full size') + "</label>"); 127 127 } else if ( this.currentImage.thumb ) { 128 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.icon+ "</label>");128 display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + __('Icon') + "</label>"); 129 129 } 130 130 if ( display.length ) { 131 display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title+ "</label>");132 h += "<tr><th style='padding-bottom:.5em'>" + this.show+ "</th><td style='padding-bottom:.5em'>";131 display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + __('Title') + "</label>"); 132 h += "<tr><th style='padding-bottom:.5em'>" + __('Show:') + "</th><td style='padding-bottom:.5em'>"; 133 133 jQuery(display).each( function() { h += this; } ); 134 134 h += "</td></tr>"; 135 135 } 136 136 137 h += "<tr><th>" + this.link+ "</th><td>";138 h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> " + this.file+ "</label><br />";139 h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> " + this.page+ "</label><br />";140 h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> " + this.none+ "</label>";137 h += "<tr><th>" + __('Link to:') + "</th><td>"; 138 h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> " + __('File') + "</label><br />"; 139 h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> " + __('Page') + "</label><br />"; 140 h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> " + __('None') + "</label>"; 141 141 h += "</td></tr>"; 142 142 143 143 h += "<tr><td colspan='2'><p class='submit'>"; 144 h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='" + this.editorText+ "' />";144 h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='" + __('Send to editor »').attribute_escape() + "' />"; 145 145 h += "</p></td></tr></table>"; 146 146 h += "</form>"; 147 147 … … 170 170 } else { 171 171 h += "<a href='#' onclick='return theFileList.cancelView();'"; 172 172 } 173 h += " title='" + this.browseTitle + "' class='back'>" + this.back+ "</a>";173 h += " title='" + __('Browse your files').attribute_escape() + "' class='back'>" + __('« Back') + "</a>"; 174 174 h += "<div id='file-title'>" 175 175 if ( 0 == this.currentImage.isImage ) 176 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle+ "'>" + this.currentImage.title + "</a></h2>";176 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + __('Direct link to file').attribute_escape() + "'>" + this.currentImage.title + "</a></h2>"; 177 177 else 178 178 h += "<h2>" + this.currentImage.title + "</h2>"; 179 179 h += " — <span>"; 180 h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + this.insert+ "</a>";180 h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + __('Insert') + "</a>"; 181 181 h += "</span>"; 182 182 h += '</div>' 183 183 h += "<div id='upload-file-view' class='alignleft'>"; 184 184 if ( 1 == this.currentImage.isImage ) { 185 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle+ "'>";185 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + __('Direct link to file').attribute_escape() + "'>"; 186 186 h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 187 187 h += "</a>"; 188 188 } else … … 191 191 192 192 193 193 h += "<table><col /><col class='widefat' /><tr>"; 194 h += "<th scope='row'><label for='url'>" + this.urlText+ "</label></th>";194 h += "<th scope='row'><label for='url'>" + __('URL') + "</label></th>"; 195 195 h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>"; 196 196 h += "</tr><tr>"; 197 h += "<th scope='row'><label for='post_title'>" + this.title+ "</label></th>";197 h += "<th scope='row'><label for='post_title'>" + __('Title') + "</label></th>"; 198 198 h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>"; 199 199 h += "</tr><tr>"; 200 h += "<th scope='row'><label for='post_content'>" + this.desc+ "</label></th>";200 h += "<th scope='row'><label for='post_content'>" + __('Description') + "</label></th>"; 201 201 h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>"; 202 h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + this.deleteText+ "' onclick='theFileList.deleteFile(" + id + ");' />";202 h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + __('Delete File').attribute_escape() + "' onclick='theFileList.deleteFile(" + id + ");' />"; 203 203 h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />"; 204 204 h += "<input type='hidden' name='action' id='action-value' value='save' />"; 205 205 h += "<input type='hidden' name='ID' value='" + id + "' />"; 206 206 h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />"; 207 h += "<div class='submit'><input type='submit' value='" + this.saveText+ "' /></div>";207 h += "<div class='submit'><input type='submit' value='" + __('Save »').attribute_escape() + "' /></div>"; 208 208 h += "</td></tr></table></form>"; 209 209 210 210 jQuery(h).prependTo('#upload-content'); … … 277 277 }, 278 278 279 279 deleteFile: function(id) { 280 if ( confirm( this.confirmText.replace(/%title%/g, this.currentImage.title) ) ) {280 if ( confirm( __("Are you sure you want to delete the file '{title}'?\nClick ok to delete or cancel to go back.").format({title: this.currentImage.title}) ) ) { 281 281 jQuery('#action-value').attr('value','delete'); 282 282 jQuery('#upload-file').submit(); 283 283 return true; … … 287 287 288 288 }; 289 289 290 for ( var property in uploadL10n )291 theFileList[property] = uploadL10n[property];292 290 theFileList.initializeVars(); 293 291 theFileList.initializeLinks(); 294 292 } ); -
wp-admin/js/cat.js
5 5 if ( !jaxcat ) 6 6 return false; 7 7 // These multiple blank hidden inputs are needed: https://bugzilla.mozilla.org/show_bug.cgi?id=377815 , #3895 , #4664 8 Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + catL10n.how+ '</span></span>');8 Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + __('Add').attribute_escape() + '"/><input type="hidden"/><input type="hidden"/><span id="howto">' + __('Separate multiple categories with commas.') + '</span></span>'); 9 9 $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); }; 10 10 $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); }; 11 11 } -
wp-admin/js/dbx-admin-key.js
1 addLoadEvent( function() {var manager = new dbxManager( dbx L10n.manager );} );1 addLoadEvent( function() {var manager = new dbxManager( dbxOptions.manager );} ); 2 2 3 3 addLoadEvent( function() 4 4 { … … 11 11 '10', // animate re-ordering [frames per transition, or '0' for no effect] 12 12 'yes', // include open/close toggle buttons ['yes'|'no'] 13 13 'closed', // default state ['open'|'closed'] 14 dbxL10n.open, // word for "open", as in "open this box"15 dbxL10n.close, // word for "close", as in "close this box"16 dbxL10n.moveMouse, // sentence for "move this box" by mouse17 dbxL10n.toggleMouse, // pattern-match sentence for "(open|close) this box" by mouse18 dbxL10n.moveKey, // sentence for "move this box" by keyboard19 dbxL10n.toggleKey, // pattern-match sentence-fragment for "(open|close) this box" by keyboard14 __('open'), // word for "open", as in "open this box" 15 __('close'), // word for "close", as in "close this box" 16 __('click-down and drag to move this box'), // sentence for "move this box" by mouse 17 __('click to %toggle% this box'), // pattern-match sentence for "(open|close) this box" by mouse 18 __('use the arrow keys to move this box'), // sentence for "move this box" by keyboard 19 __(', or press the enter key to %toggle% it'), // pattern-match sentence-fragment for "(open|close) this box" by keyboard 20 20 '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts 21 21 ); 22 22 … … 36 36 '10', 37 37 'yes', 38 38 'closed', 39 dbxL10n.open,40 dbxL10n.close,41 dbxL10n.moveMouse,42 dbxL10n.toggleMouse,43 dbxL10n.moveKey,44 dbxL10n.toggleKey,39 __('open'), 40 __('close'), 41 __('click-down and drag to move this box'), 42 __('click to %toggle% this box'), 43 __('use the arrow keys to move this box'), 44 __(', or press the enter key to %toggle% it'), 45 45 '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts 46 46 ); 47 47 }); -
wp-admin/js/link-cat.js
4 4 var jaxcat = $('jaxcat'); 5 5 if ( !jaxcat ) 6 6 return false; 7 Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + linkcatL10n.add + '"/><input type="hidden"/><span id="howto">' + linkcatL10n.how+ '</span></span>');7 Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + __('Add').attribute_escape() + '"/><input type="hidden"/><span id="howto">' + __('Separate multiple categories with commas.') + '</span></span>'); 8 8 $('newcat').onkeypress = function(e) { return killSubmit("linkcatList.ajaxAdder('link-category','jaxcat');", e); }; 9 9 $('catadd').onclick = function() { linkcatList.ajaxAdder('link-category', 'jaxcat'); }; 10 10 }