Make WordPress Core

Ticket #4559: js-i18n.diff

File js-i18n.diff, 34.2 KB (added by nbachiyski, 16 years ago)
  • wp-includes/js/wp-ajax.js

     
    33Object.extend(WPAjax.prototype, {
    44        WPComplete: false, // onComplete function
    55        WPError: false, // onWPError function
    6         defaultUrl: '', // We get these from WPAjaxL10n
    7         permText: '',
    8         strangeText: '',
    9         whoaText: '',
    106
    117        initialize: function(url, responseEl) {
    128                var tempObj = this;
     
    2319                                        tempObj.WPError(transport);
    2420                        }
    2521                });
    26                 this.url = url ? url : this.defaultUrl;
     22                this.url = url ? url : WPAjaxOptions.defaultUrl;
    2723                this.getResponseElement(responseEl);
    2824        },
    2925        addArg: function(key, value) {
     
    5652                }
    5753                var r = parseInt(r,10);
    5854                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>");
    6056                        return false;
    6157                } 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>");
    6359                        return false;
    6460                }
    6561                return true;
     
    7571        }
    7672});
    7773
    78 Event.observe( window, 'load', function() { Object.extend(WPAjax.prototype, WPAjaxL10n); }, false )
    79 
    8074Ajax.activeSendCount = 0;
    8175Ajax.Responders.register( {
    8276        onCreate: function() {
     
    8579                        return;
    8680                wpBeforeUnload = window.onbeforeunload;
    8781                window.onbeforeunload = function() {
    88                         return WPAjax.whoaText;
     82                        return __("Slow down, I'm still sending your data!");
    8983                }
    9084        },
    9185        onLoading: function() { // Can switch to onLoaded if we lose data
  • wp-includes/js/autosave.js

     
    55        var form = $('post');
    66        autosaveLast = form.post_title.value+form.content.value;
    77        // Keep autosave_interval in sync with edit_post().
    8         autosavePeriodical = new PeriodicalExecuter(autosave, autosaveL10n.autosaveInterval);
     8        autosavePeriodical = new PeriodicalExecuter(autosave, autosaveOptions.autosaveInterval);
    99        //Disable autosave after the form has been submitted
    1010        if(form.addEventListener) {
    1111                form.addEventListener("submit", function () { autosavePeriodical.currentlyExecuting = true; }, false);
     
    3737        var message;
    3838
    3939        if(isNaN(res)) {
    40                 message = autosaveL10n.errorText.replace(/%response%/g, response);
     40                message = gettext.format(__('Error: {response}'), {response: response});
    4141        } else {
    42                 message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time());
     42                message = gettext.format(__('Saved at {time}.'), {time: autosave_cur_time()});
    4343                $('post_ID').name = "post_ID";
    4444                $('post_ID').value = res;
    4545                // We need new nonces
     
    4949                nonceAjax.setVar("post_ID", res);
    5050                nonceAjax.setVar("cookie", document.cookie);
    5151                nonceAjax.setVar("post_type", $('post_type').value);
    52                 nonceAjax.requestFile = autosaveL10n.requestFile;
     52                nonceAjax.requestFile = autosaveOptions.requestFile;
    5353                nonceAjax.onCompletion = autosave_update_nonce;
    5454                nonceAjax.method = "POST";
    5555                nonceAjax.runAJAX();
     
    6060}
    6161
    6262function autosave_loading() {
    63         $('autosave').innerHTML = autosaveL10n.savingText;
     63        $('autosave').innerHTML = __('Saving Draft...');
    6464}
    6565
    6666function autosave_saved() {
     
    6969        var message;
    7070
    7171        if(isNaN(res)) {
    72                 message = autosaveL10n.errorText.replace(/%response%/g, response);
     72                message = gettext.format(__('Error: {response}'), {response: response});
    7373        } else {
    74                 message = autosaveL10n.saveText.replace(/%time%/g, autosave_cur_time());
     74                message = gettext.format(__('Saved at {time}.'), {time: autosave_cur_time()});
    7575        }
    7676        $('autosave').innerHTML = message;
    7777        autosave_enable_buttons();
     
    145145                autosaveAjax.setVar("content", form.content.value);
    146146        }
    147147
    148         autosaveAjax.requestFile = autosaveL10n.requestFile;
     148        autosaveAjax.requestFile = autosaveOptions.requestFile;
    149149        autosaveAjax.method = "POST";
    150150        autosaveAjax.element = null;
    151151        autosaveAjax.onLoading = autosave_loading;
  • wp-includes/js/list-manipulation.js

     
    11addLoadEvent( function() {
    2         if ( 'undefined' != typeof listManL10n )
    3                 Object.extend(listMan.prototype, listManL10n);
    42        theList = new listMan();
    53} );
    64
     
    86        if ( !obj )
    97                obj=theList;
    108        if ( !message )
    11                 message = obj.delText.replace(/%thing%/g, what);
     9                message = __('Are you sure you want to delete this {thing}').format({thing: what});
    1210        if( confirm(message) )
    1311                return obj.ajaxDelete( what, id );
    1412        else return false;
     
    3634        dataStore: null,
    3735        formStore: null,
    3836
    39         jumpText: '', // We get these from listManL10n
    40         delText: '',
    41 
    4237        initialize: function(theListId) {
    4338                this.theList = $(theListId ? theListId : 'the-list');
    4439                if ( !this.theList )
     
    7368                                        if ( m )
    7469                                                showLinkMessage += m;
    7570                                        else
    76                                                 showLinkMessage += "<a href='#" + what + '-' + id + "'>" + tempObj.jumpText + "</a>";
     71                                                showLinkMessage += "<a href='#" + what + '-' + id + "'>" + __("Jump to new item") + "</a>";
    7772                                });
    7873                                if ( tempObj.showLink && showLinkMessage )
    7974                                        Element.update(ajaxAdd.myResponseElement,"<div id='jumplink' class='updated fade'><p>" + showLinkMessage + "</p></div>");
  • wp-includes/js/quicktags.js

     
    168168}
    169169
    170170function 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>';
    172172        for (i = 0; i < edLinks.length; i++) {
    173173                tempStr += '<option value="' + i + '">' + edLinks[i].display + '</option>';
    174174        }
     
    248248                }
    249249        }
    250250        if (word == '') {
    251                 word = prompt(quicktagsL10n.wordLookup, '');
     251                word = prompt(__('Enter a word to look up:'), '');
    252252        }
    253253        if (word !== null && /^\w[\w ]*$/.test(word)) {
    254254                window.open('http://www.answers.com/' + escape(word));
     
    260260        for (i = 0; i < edButtons.length; i++) {
    261261                edShowButton(edButtons[i], i);
    262262        }
    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() + '" />');
    265265//      edShowLinks(); // disabled by default
    266266        document.write('</div>');
    267267}
     
    366366                defaultValue = 'http://';
    367367        }
    368368        if (!edCheckOpenTags(i)) {
    369                 var URL = prompt(quicktagsL10n.enterURL, defaultValue);
     369                var URL = prompt(__('Enter the URL'), defaultValue);
    370370                if (URL) {
    371371                        edButtons[i].tagStart = '<a href="' + URL + '">';
    372372                        edInsertTag(myField, i);
     
    378378}
    379379
    380380function edInsertImage(myField) {
    381         var myValue = prompt(quicktagsL10n.enterImageURL, 'http://');
     381        var myValue = prompt(__('Enter the URL of the image'), 'http://');
    382382        if (myValue) {
    383383                myValue = '<img src="'
    384384                                + myValue
    385                                 + '" alt="' + prompt(quicktagsL10n.enterImageDescription, '')
     385                                + '" alt="' + prompt(__('Enter a description of the image'), '')
    386386                                + '" />';
    387387                edInsertContent(myField, myValue);
    388388        }
  • wp-includes/script-loader.php

     
    1717                $this->add( 'sack', '/wp-includes/js/tw-sack.js', false, '1.6.1' );
    1818
    1919                $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 
    3220                $this->add( 'colorpicker', '/wp-includes/js/colorpicker.js', false, '3517' );
    3321
    3422                $this->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_gzip.php', false, '20070528' );
     
    3826                $this->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.5.1.1');
    3927
    4028                $this->add( 'autosave', '/wp-includes/js/autosave.js', array('prototype', 'sack'), '20070306');
    41                 $this->localize( 'autosave', 'autosaveL10n', array(
     29                $this->addoptions( 'autosave', 'autosaveOptions', array(
    4230                        'autosaveInterval' => apply_filters('autosave_interval', '120'),
    43                         'errorText' => __('Error: %response%'),
    44                         'saveText' => __('Saved at %time%.'),
    4531                        'requestFile' => get_option( 'siteurl' ) . '/wp-admin/admin-ajax.php',
    46                         'savingText' => __('Saving Draft...')
    4732                ) );
    48 
    4933                $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(
    5135                        '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!")
    5536                ) );
    56 
    5737                $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 
    6338                $this->add( 'scriptaculous-root', '/wp-includes/js/scriptaculous/scriptaculous.js', array('prototype'), '1.7.1-b3');
    6439                $this->add( 'scriptaculous-builder', '/wp-includes/js/scriptaculous/builder.js', array('scriptaculous-root'), '1.7.1-b3');
    6540                $this->add( 'scriptaculous-dragdrop', '/wp-includes/js/scriptaculous/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.7.1-b3');
     
    9469                        endswitch;
    9570                        if ( $man ) {
    9671                                $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(
    9873                                        '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'),
    10574                                ) );
    10675                        }
    10776                        $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                         ) );
    11277                        $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                         ) );
    11778                        $this->add( 'admin-categories', '/wp-admin/js/categories.js', array('listman'), '3684' );
    11879                        $this->add( 'admin-custom-fields', '/wp-admin/js/custom-fields.js', array('listman'), '3733' );
    11980                        $this->add( 'admin-comments', '/wp-admin/js/edit-comments.js', array('listman'), '20070327' );
    12081                        $this->add( 'admin-users', '/wp-admin/js/users.js', array('listman'), '4583' );
    12182                        $this->add( 'xfn', '/wp-admin/js/xfn.js', false, '3517' );
    12283                        $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' => __('&laquo; 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 &raquo;')),
    138                                 'insert' => __('Insert'),
    139                                 'urlText' => __('URL'),
    140                                 'desc' => __('Description'),
    141                                 'deleteText' => attribute_escape(__('Delete File')),
    142                                 'saveText' => attribute_escape(__('Save &raquo;')),
    143                                 'confirmText' => __("Are you sure you want to delete the file '%title%'?\nClick ok to delete or cancel to go back.")
    144                         ) );
    14584                }
    14685        }
    14786
     
    15796                // Print the queue if nothing is passed.  If a string is passed, print that script.  If an array is passed, print those scripts.
    15897                $handles = false === $handles ? $this->queue : (array) $handles;
    15998                $handles = $this->all_deps( $handles );
     99                $this->print_scripts_l10n( array_keys($handles) );
    160100                $this->_print_scripts( $handles );
    161101                return $this->printed;
    162102        }
     
    190130                                        $src = add_query_arg('ver', $ver, $src);
    191131                                        $src = clean_url(apply_filters( 'script_loader_src', $src ));
    192132                                        echo "<script type='text/javascript' src='$src'></script>\n";
    193                                         $this->print_scripts_l10n( $handle );
     133                                        $this->print_scripts_options( $handle );
    194134                                }
    195135                                $this->printed[] = $handle;
    196136                        }
    197137                }
    198138        }
    199139
    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) ) {
    202142                        return;
    203 
    204                 $object_name = $this->scripts[$handle]->l10n_object;
    205 
     143                }
     144                $object_name = $this->scripts[$handle]->options_object;
    206145                echo "<script type='text/javascript'>\n";
    207146                echo "/* <![CDATA[ */\n";
    208147                echo "\t$object_name = {\n";
    209148                $eol = '';
    210                 foreach ( $this->scripts[$handle]->l10n as $var => $val ) {
    211                         echo "$eol\t\t$var: \"" . js_escape( $val ) . '"';
     149                foreach ( $this->scripts[$handle]->options as $var => $val ) {
     150                echo "$eol\t\t$var: \"" . js_escape( $val ) . '"';
    212151                        $eol = ",\n";
    213152                }
    214153                echo "\n\t}\n";
     
    217156        }
    218157
    219158        /**
     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        /**
    220226         * Determines dependencies of scripts
    221227         *
    222228         * Recursively builds hierarchical array of script dependencies.  Does NOT catch infinite loops.
     
    267273        }
    268274
    269275        /**
    270          * Localizes a script
     276         * Adds options to the script.
    271277         *
    272          * Localizes only if script has already been added
     278         * Adds options from the server-side environment to the script.
    273279         *
    274280         * @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         *
    278285         */
    279         function localize( $handle, $object_name, $l10n ) {
     286        function addoptions( $handle, $object_name, $options ) {
    280287                if ( !isset($this->scripts[$handle]) )
    281288                        return false;
    282                 return $this->scripts[$handle]->localize( $object_name, $l10n );
     289                return $this->scripts[$handle]->addoptions( $object_name, $options );
    283290        }
    284291
     292
    285293        function remove( $handles ) {
    286294                foreach ( (array) $handles as $handle )
    287295                        unset($this->scripts[$handle]);
     
    335343                        $this->ver = false;
    336344        }
    337345
    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) )
    340348                        return false;
    341                 $this->l10n_object = $object_name;
    342                 $this->l10n = $l10n;
     349                $this->options_object = $object_name;
     350                $this->options = $options;
    343351                return true;
    344352        }
    345353}
     
    378386        $wp_scripts->add( $handle, $src, $deps, $ver );
    379387}
    380388
    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 ) {
     389function wp_script_options( $handle, $object_name, $options ) {
    389390        global $wp_scripts;
    390         if ( !is_a($wp_scripts, 'WP_Scripts') )
    391                 return false;
    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 );
    394395}
    395396
    396397function wp_deregister_script( $handle ) {
  • wp-includes/l10n.php

     
    107107        load_textdomain($domain, $mofile);
    108108}
    109109
     110/**
     111 * Returns an array with the translations from the specified gettext domain
     112 */
     113function &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
    110124?>
  • wp-settings.php

     
    140140include_once(ABSPATH . WPINC . '/streams.php');
    141141include_once(ABSPATH . WPINC . '/gettext.php');
    142142require_once (ABSPATH . WPINC . '/l10n.php');
     143require_once (ABSPATH. WPINC . '/jsgettext.php');
    143144
    144145if ( !is_blog_installed() && (strpos($_SERVER['PHP_SELF'], 'install.php') === false && !defined('WP_INSTALLING')) ) {
    145146        if ( defined('WP_SITEURL') )
  • wp-admin/js/upload.js

     
    9494                        } else {
    9595                                h += "<a href='#' onclick='return theFileList.cancelView();'";
    9696                        }
    97                         h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
     97                        h += " title='" + __('Browse your files').attribute_escape() + "' class='back'>" + __('&laquo; Back') + "</a>";
    9898                        h += "<div id='file-title'>"
    9999                        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>";
    101101                        else
    102102                                h += "<h2>" + this.currentImage.title + "</h2>";
    103103                        h += " &#8212; <span>";
    104                         h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + this.edit + "</a>"
     104                        h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + __('Edit') + "</a>"
    105105                        h += "</span>";
    106106                        h += '</div>'
    107107                        h += "<div id='upload-file-view' class='alignleft'>";
    108108                        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() + "'>";
    110110                                h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
    111111                                h += "</a>";
    112112                        } else
     
    120120                        if ( 1 == this.currentImage.isImage ) {
    121121                                checked = 'display-full';
    122122                                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 />");
    124124                                        checked = 'display-thumb';
    125125                                }
    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>");
    127127                        } 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>");
    129129                        }
    130130                        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'>";
    133133                                jQuery(display).each( function() { h += this; } );
    134134                                h += "</td></tr>";
    135135                        }
    136136
    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>";
    141141                        h += "</td></tr>";
    142142
    143143                        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 &raquo;').attribute_escape() + "' />";
    145145                        h += "</p></td></tr></table>";
    146146                        h += "</form>";
    147147
     
    170170                        } else {
    171171                                h += "<a href='#' onclick='return theFileList.cancelView();'";
    172172                        }
    173                         h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>";
     173                        h += " title='" + __('Browse your files').attribute_escape() + "' class='back'>" + __('&laquo; Back') + "</a>";
    174174                        h += "<div id='file-title'>"
    175175                        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>";
    177177                        else
    178178                                h += "<h2>" + this.currentImage.title + "</h2>";
    179179                        h += " &#8212; <span>";
    180                         h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + this.insert + "</a>";
     180                        h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + __('Insert') + "</a>";
    181181                        h += "</span>";
    182182                        h += '</div>'
    183183                        h += "<div id='upload-file-view' class='alignleft'>";
    184184                        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() + "'>";
    186186                                h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />";
    187187                                h += "</a>";
    188188                        } else
     
    191191
    192192
    193193                        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>";
    195195                        h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>";
    196196                        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>";
    198198                        h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>";
    199199                        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>";
    201201                        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 + ");' />";
    203203                        h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />";
    204204                        h += "<input type='hidden' name='action' id='action-value' value='save' />";
    205205                        h += "<input type='hidden' name='ID' value='" + id + "' />";
    206206                        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 &raquo;').attribute_escape() + "' /></div>";
    208208                        h += "</td></tr></table></form>";
    209209
    210210                        jQuery(h).prependTo('#upload-content');
     
    277277                },
    278278
    279279                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}) ) ) {
    281281                                jQuery('#action-value').attr('value','delete');
    282282                                jQuery('#upload-file').submit();
    283283                                return true;
     
    287287
    288288        };
    289289
    290         for ( var property in uploadL10n )
    291                 theFileList[property] = uploadL10n[property];
    292290        theFileList.initializeVars();
    293291        theFileList.initializeLinks();
    294292} );
  • wp-admin/js/cat.js

     
    55        if ( !jaxcat )
    66                return false;
    77        // 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>');
    99        $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); };
    1010        $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); };
    1111}
  • wp-admin/js/dbx-admin-key.js

     
    1 addLoadEvent( function() {var manager = new dbxManager( dbxL10n.manager );} );
     1addLoadEvent( function() {var manager = new dbxManager( dbxOptions.manager );} );
    22
    33addLoadEvent( function()
    44{
     
    1111                '10',                   // animate re-ordering [frames per transition, or '0' for no effect]
    1212                'yes',                  // include open/close toggle buttons ['yes'|'no']
    1313                '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 mouse
    17                 dbxL10n.toggleMouse,    // pattern-match sentence for "(open|close) this box" by mouse
    18                 dbxL10n.moveKey,        // sentence for "move this box" by keyboard
    19                 dbxL10n.toggleKey,      // pattern-match sentence-fragment for "(open|close) this box" by keyboard
     14                __('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
    2020                '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
    2121                );
    2222
     
    3636                '10',
    3737                'yes',
    3838                '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'),
    4545                '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts
    4646                );
    4747});
  • wp-admin/js/link-cat.js

     
    44        var jaxcat = $('jaxcat');
    55        if ( !jaxcat )
    66                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>');
    88        $('newcat').onkeypress = function(e) { return killSubmit("linkcatList.ajaxAdder('link-category','jaxcat');", e); };
    99        $('catadd').onclick = function() { linkcatList.ajaxAdder('link-category', 'jaxcat'); };
    1010}