Make WordPress Core

Ticket #23282: 23282.i18n.patch

File 23282.i18n.patch, 4.4 KB (added by dimadin, 12 years ago)
  • wp-includes/js/mediaelement/mediaelement-and-player.js

     
    16451645     * @see: i18n.methods.t()
    16461646     */
    16471647    i18n.locale.getLanguage = function () {
    1648         return {
     1648        return mejs.locale || {
    16491649            "language" : navigator.language
    16501650        };
    16511651    };
     
    17351735     *   The translated string.
    17361736     */
    17371737    i18n.methods.t = function (str, args, options) {
    1738 
    17391738        // Fetch the localized version of the string.
    17401739        if (i18n.locale.strings && i18n.locale.strings[options.context] && i18n.locale.strings[options.context][str]) {
    17411740            str = i18n.locale.strings[options.context][str];
     
    17441743        if (args) {
    17451744            str = i18n.methods.formatString(str, args);
    17461745        }
     1746
    17471747        return str;
    17481748    };
    17491749
     
    18061806
    18071807}(mejs.i18n.locale.strings));
    18081808
     1809;(function(exports, undefined) {
     1810
     1811    "use strict";
     1812
     1813        if ( mejs.locale.language && mejs.locale.strings ) {
     1814                exports[mejs.locale.language] = mejs.locale.strings;
     1815        }
     1816
     1817}(mejs.i18n.locale.strings));
     1818
    18091819/*!
    18101820 * MediaElementPlayer
    18111821 * http://mediaelementjs.com/
     
    28982908(function($) {
    28992909
    29002910        $.extend(mejs.MepDefaults, {
    2901                 playpauseText: 'Play/Pause'
     2911                playpauseText: mejs.i18n.t('Play/Pause')
    29022912        });
    29032913
    29042914        // PLAY/pause BUTTON
     
    32253235(function($) {
    32263236
    32273237        $.extend(mejs.MepDefaults, {
    3228                 muteText: 'Mute Toggle',
     3238                muteText: mejs.i18n.t('Mute Toggle'),
    32293239                hideVolumeOnTouchDevices: true,
    32303240               
    32313241                audioVolume: 'horizontal',
     
    38893899                // this will automatically turn on a <track>
    38903900                startLanguage: '',
    38913901               
    3892                 tracksText: 'Captions/Subtitles'
     3902                tracksText: mejs.i18n.t('Captions/Subtitles')
    38933903        });
    38943904
    38953905        $.extend(MediaElementPlayer.prototype, {
     
    39193929                                                        '<ul>'+
    39203930                                                                '<li>'+
    39213931                                                                        '<input type="radio" name="' + player.id + '_captions" id="' + player.id + '_captions_none" value="none" checked="checked" />' +
    3922                                                                         '<label for="' + player.id + '_captions_none">None</label>'+
     3932                                                                        '<label for="' + player.id + '_captions_none">' + mejs.i18n.t('None') +'</label>'+
    39233933                                                                '</li>' +
    39243934                                                        '</ul>'+
    39253935                                                '</div>'+
     
    44374447                                        return null;
    44384448                       
    44394449                                if (player.isFullScreen) {
    4440                                         return "Turn off Fullscreen";
     4450                                        return mejs.i18n.t("Turn off Fullscreen");
    44414451                                } else {
    4442                                         return "Go Fullscreen";
     4452                                        return mejs.i18n.t("Go Fullscreen");
    44434453                                }
    44444454                        },
    44454455                        click: function(player) {
     
    44554465                {
    44564466                        render: function(player) {
    44574467                                if (player.media.muted) {
    4458                                         return "Unmute";
     4468                                        return mejs.i18n.t("Unmute");
    44594469                                } else {
    4460                                         return "Mute";
     4470                                        return mejs.i18n.t("Mute");
    44614471                                }
    44624472                        },
    44634473                        click: function(player) {
     
    44764486                // demo of simple download video
    44774487                {
    44784488                        render: function(player) {
    4479                                 return "Download Video";
     4489                                return mejs.i18n.t("Download Video");
    44804490                        },
    44814491                        click: function(player) {
    44824492                                window.location.href = player.media.currentSrc;
  • wp-includes/script-loader.php

     
    278278        $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.8', 1 );
    279279
    280280        $scripts->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array('jquery'), '2.10.1', 1 );
     281        did_action( 'init' ) && $scripts->localize( 'mediaelement', 'mejs', array(
     282                'locale' => array(
     283                        'language' => get_bloginfo( 'language' ),
     284                        'strings' => array(
     285                                'Close' => __( 'Close' ),
     286                                'Fullscreen' => __( 'Fullscreen' ),
     287                                'Download File' => __( 'Download File' ),
     288                                'Play/Pause' => __( 'Play/Pause' ),
     289                                'Mute Toggle' => __( 'Mute Toggle' ),
     290                                'None' => __( 'None' ),
     291                                'Turn off Fullscreen' => __( 'Turn off Fullscreen' ),
     292                                'Go Fullscreen' => __( 'Go Fullscreen' ),
     293                                'Unmute' => __( 'Unmute' ),
     294                                'Mute' => __( 'Mute' )
     295                        )
     296                )
     297        ) );
     298
    281299        $scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement.js", array('mediaelement'), false, 1 );
    282300
    283301        $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), false, 1 );