diff --git a/src/js/_enqueues/admin/common.js b/src/js/_enqueues/admin/common.js index 2a7daba0d2dc4..bf9aa5163e389 100644 --- a/src/js/_enqueues/admin/common.js +++ b/src/js/_enqueues/admin/common.js @@ -16,357 +16,7 @@ var $document = $( document ), $window = $( window ), $body = $( document.body ), - __ = wp.i18n.__, - sprintf = wp.i18n.sprintf; - -/** - * Throws an error for a deprecated property. - * - * @since 5.5.1 - * - * @param {string} propName The property that was used. - * @param {string} version The version of WordPress that deprecated the property. - * @param {string} replacement The property that should have been used. - */ -function deprecatedProperty( propName, version, replacement ) { - var message; - - if ( 'undefined' !== typeof replacement ) { - message = sprintf( - /* translators: 1: Deprecated property name, 2: Version number, 3: Alternative property name. */ - __( '%1$s is deprecated since version %2$s! Use %3$s instead.' ), - propName, - version, - replacement - ); - } else { - message = sprintf( - /* translators: 1: Deprecated property name, 2: Version number. */ - __( '%1$s is deprecated since version %2$s with no alternative available.' ), - propName, - version - ); - } - - window.console.warn( message ); -} - -/** - * Deprecate all properties on an object. - * - * @since 5.5.1 - * @since 5.6.0 Added the `version` parameter. - * - * @param {string} name The name of the object, i.e. commonL10n. - * @param {object} l10nObject The object to deprecate the properties on. - * @param {string} version The version of WordPress that deprecated the property. - * - * @return {object} The object with all its properties deprecated. - */ -function deprecateL10nObject( name, l10nObject, version ) { - var deprecatedObject = {}; - - Object.keys( l10nObject ).forEach( function( key ) { - var prop = l10nObject[ key ]; - var propName = name + '.' + key; - - if ( 'object' === typeof prop ) { - Object.defineProperty( deprecatedObject, key, { get: function() { - deprecatedProperty( propName, version, prop.alternative ); - return prop.func(); - } } ); - } else { - Object.defineProperty( deprecatedObject, key, { get: function() { - deprecatedProperty( propName, version, 'wp.i18n' ); - return prop; - } } ); - } - } ); - - return deprecatedObject; -} - -window.wp.deprecateL10nObject = deprecateL10nObject; - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 2.6.0 - * @deprecated 5.5.0 - */ -window.commonL10n = window.commonL10n || { - warnDelete: '', - dismiss: '', - collapseMenu: '', - expandMenu: '' -}; - -window.commonL10n = deprecateL10nObject( 'commonL10n', window.commonL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 3.3.0 - * @deprecated 5.5.0 - */ -window.wpPointerL10n = window.wpPointerL10n || { - dismiss: '' -}; - -window.wpPointerL10n = deprecateL10nObject( 'wpPointerL10n', window.wpPointerL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 4.3.0 - * @deprecated 5.5.0 - */ -window.userProfileL10n = window.userProfileL10n || { - warn: '', - warnWeak: '', - show: '', - hide: '', - cancel: '', - ariaShow: '', - ariaHide: '' -}; - -window.userProfileL10n = deprecateL10nObject( 'userProfileL10n', window.userProfileL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 4.9.6 - * @deprecated 5.5.0 - */ -window.privacyToolsL10n = window.privacyToolsL10n || { - noDataFound: '', - foundAndRemoved: '', - noneRemoved: '', - someNotRemoved: '', - removalError: '', - emailSent: '', - noExportFile: '', - exportError: '' -}; - -window.privacyToolsL10n = deprecateL10nObject( 'privacyToolsL10n', window.privacyToolsL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 3.6.0 - * @deprecated 5.5.0 - */ -window.authcheckL10n = { - beforeunload: '' -}; - -window.authcheckL10n = window.authcheckL10n || deprecateL10nObject( 'authcheckL10n', window.authcheckL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 2.8.0 - * @deprecated 5.5.0 - */ -window.tagsl10n = { - noPerm: '', - broken: '' -}; - -window.tagsl10n = window.tagsl10n || deprecateL10nObject( 'tagsl10n', window.tagsl10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 2.5.0 - * @deprecated 5.5.0 - */ -window.adminCommentsL10n = window.adminCommentsL10n || { - hotkeys_highlight_first: { - alternative: 'window.adminCommentsSettings.hotkeys_highlight_first', - func: function() { return window.adminCommentsSettings.hotkeys_highlight_first; } - }, - hotkeys_highlight_last: { - alternative: 'window.adminCommentsSettings.hotkeys_highlight_last', - func: function() { return window.adminCommentsSettings.hotkeys_highlight_last; } - }, - replyApprove: '', - reply: '', - warnQuickEdit: '', - warnCommentChanges: '', - docTitleComments: '', - docTitleCommentsCount: '' -}; - -window.adminCommentsL10n = deprecateL10nObject( 'adminCommentsL10n', window.adminCommentsL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 2.5.0 - * @deprecated 5.5.0 - */ -window.tagsSuggestL10n = window.tagsSuggestL10n || { - tagDelimiter: '', - removeTerm: '', - termSelected: '', - termAdded: '', - termRemoved: '' -}; - -window.tagsSuggestL10n = deprecateL10nObject( 'tagsSuggestL10n', window.tagsSuggestL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 3.5.0 - * @deprecated 5.5.0 - */ -window.wpColorPickerL10n = window.wpColorPickerL10n || { - clear: '', - clearAriaLabel: '', - defaultString: '', - defaultAriaLabel: '', - pick: '', - defaultLabel: '' -}; - -window.wpColorPickerL10n = deprecateL10nObject( 'wpColorPickerL10n', window.wpColorPickerL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 2.7.0 - * @deprecated 5.5.0 - */ -window.attachMediaBoxL10n = window.attachMediaBoxL10n || { - error: '' -}; - -window.attachMediaBoxL10n = deprecateL10nObject( 'attachMediaBoxL10n', window.attachMediaBoxL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 2.5.0 - * @deprecated 5.5.0 - */ -window.postL10n = window.postL10n || { - ok: '', - cancel: '', - publishOn: '', - publishOnFuture: '', - publishOnPast: '', - dateFormat: '', - showcomm: '', - endcomm: '', - publish: '', - schedule: '', - update: '', - savePending: '', - saveDraft: '', - 'private': '', - 'public': '', - publicSticky: '', - password: '', - privatelyPublished: '', - published: '', - saveAlert: '', - savingText: '', - permalinkSaved: '' -}; - -window.postL10n = deprecateL10nObject( 'postL10n', window.postL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 2.7.0 - * @deprecated 5.5.0 - */ -window.inlineEditL10n = window.inlineEditL10n || { - error: '', - ntdeltitle: '', - notitle: '', - comma: '', - saved: '' -}; - -window.inlineEditL10n = deprecateL10nObject( 'inlineEditL10n', window.inlineEditL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 2.7.0 - * @deprecated 5.5.0 - */ -window.plugininstallL10n = window.plugininstallL10n || { - plugin_information: '', - plugin_modal_label: '', - ays: '' -}; - -window.plugininstallL10n = deprecateL10nObject( 'plugininstallL10n', window.plugininstallL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 3.0.0 - * @deprecated 5.5.0 - */ -window.navMenuL10n = window.navMenuL10n || { - noResultsFound: '', - warnDeleteMenu: '', - saveAlert: '', - untitled: '' -}; - -window.navMenuL10n = deprecateL10nObject( 'navMenuL10n', window.navMenuL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 2.5.0 - * @deprecated 5.5.0 - */ -window.commentL10n = window.commentL10n || { - submittedOn: '', - dateFormat: '' -}; - -window.commentL10n = deprecateL10nObject( 'commentL10n', window.commentL10n, '5.5.0' ); - -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 2.9.0 - * @deprecated 5.5.0 - */ -window.setPostThumbnailL10n = window.setPostThumbnailL10n || { - setThumbnail: '', - saving: '', - error: '', - done: '' -}; - -window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n, '5.5.0' ); - -/** - * Removed in 6.5.0, needed for back-compatibility. - * - * @since 4.5.0 - * @deprecated 6.5.0 - */ -window.uiAutocompleteL10n = window.uiAutocompleteL10n || { - noResults: '', - oneResult: '', - manyResults: '', - itemSelected: '' -}; - -window.uiAutocompleteL10n = deprecateL10nObject( 'uiAutocompleteL10n', window.uiAutocompleteL10n, '6.5.0' ); + __ = wp.i18n.__; /** * Removed in 3.3.0, needed for back-compatibility. diff --git a/src/js/_enqueues/admin/widgets.js b/src/js/_enqueues/admin/widgets.js index e8fc42507d382..dbffff393d694 100644 --- a/src/js/_enqueues/admin/widgets.js +++ b/src/js/_enqueues/admin/widgets.js @@ -745,19 +745,3 @@ $( function(){ wpWidgets.init(); } ); })(jQuery); -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 4.9.0 - * @deprecated 5.5.0 - * - * @type {object} -*/ -wpWidgets.l10n = wpWidgets.l10n || { - save: '', - saved: '', - saveAlert: '', - widgetAdded: '' -}; - -wpWidgets.l10n = window.wp.deprecateL10nObject( 'wpWidgets.l10n', wpWidgets.l10n, '5.5.0' ); diff --git a/src/js/_enqueues/wp/dashboard.js b/src/js/_enqueues/wp/dashboard.js index 5216611d5dc3c..c2e00732aef04 100644 --- a/src/js/_enqueues/wp/dashboard.js +++ b/src/js/_enqueues/wp/dashboard.js @@ -826,20 +826,3 @@ jQuery( function( $ ) { } }); -/** - * Removed in 5.6.0, needed for back-compatibility. - * - * @since 4.8.0 - * @deprecated 5.6.0 - * - * @type {object} -*/ -window.communityEventsData.l10n = window.communityEventsData.l10n || { - enter_closest_city: '', - error_occurred_please_try_again: '', - attend_event_near_generic: '', - could_not_locate_city: '', - city_updated: '' -}; - -window.communityEventsData.l10n = window.wp.deprecateL10nObject( 'communityEventsData.l10n', window.communityEventsData.l10n, '5.6.0' ); diff --git a/src/js/_enqueues/wp/theme-plugin-editor.js b/src/js/_enqueues/wp/theme-plugin-editor.js index 7bcff376e9ff2..b6410806ec3f9 100644 --- a/src/js/_enqueues/wp/theme-plugin-editor.js +++ b/src/js/_enqueues/wp/theme-plugin-editor.js @@ -1029,26 +1029,3 @@ wp.themePluginEditor = (function( $ ) { return component; })( jQuery ); -/** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 4.9.0 - * @deprecated 5.5.0 - * - * @type {object} - */ -wp.themePluginEditor.l10n = wp.themePluginEditor.l10n || { - saveAlert: '', - saveError: '', - lintError: { - alternative: 'wp.i18n', - func: function() { - return { - singular: '', - plural: '' - }; - } - } -}; - -wp.themePluginEditor.l10n = window.wp.deprecateL10nObject( 'wp.themePluginEditor.l10n', wp.themePluginEditor.l10n, '5.5.0' ); diff --git a/src/js/_enqueues/wp/theme.js b/src/js/_enqueues/wp/theme.js index 56107ee475057..82799f9b2cb5f 100644 --- a/src/js/_enqueues/wp/theme.js +++ b/src/js/_enqueues/wp/theme.js @@ -1277,7 +1277,7 @@ themes.view.Themes = wp.Backbone.View.extend({ $modal.find( '.notice-warning' ) .removeClass( 'notice-large' ) .addClass( 'updating-message' ) - .find( 'p' ).text( wp.updates.l10n.updating ); + .find( 'p' ).text( wp.i18n.__( 'Updating...' ) ); } else if ( $card.find( '.notice-error' ).length ) { $modal.find( '.notice-warning' ).remove(); } diff --git a/src/js/_enqueues/wp/updates.js b/src/js/_enqueues/wp/updates.js index ef4b47e66093e..706c4f9950725 100644 --- a/src/js/_enqueues/wp/updates.js +++ b/src/js/_enqueues/wp/updates.js @@ -48,81 +48,6 @@ */ wp.updates = {}; - /** - * Removed in 5.5.0, needed for back-compatibility. - * - * @since 4.2.0 - * @deprecated 5.5.0 - * - * @type {object} - */ - wp.updates.l10n = { - searchResults: '', - searchResultsLabel: '', - noPlugins: '', - noItemsSelected: '', - updating: '', - pluginUpdated: '', - themeUpdated: '', - update: '', - updateNow: '', - pluginUpdateNowLabel: '', - updateFailedShort: '', - updateFailed: '', - pluginUpdatingLabel: '', - pluginUpdatedLabel: '', - pluginUpdateFailedLabel: '', - updatingMsg: '', - updatedMsg: '', - updateCancel: '', - beforeunload: '', - installNow: '', - pluginInstallNowLabel: '', - installing: '', - pluginInstalled: '', - themeInstalled: '', - installFailedShort: '', - installFailed: '', - pluginInstallingLabel: '', - themeInstallingLabel: '', - pluginInstalledLabel: '', - themeInstalledLabel: '', - pluginInstallFailedLabel: '', - themeInstallFailedLabel: '', - installingMsg: '', - installedMsg: '', - importerInstalledMsg: '', - aysDelete: '', - aysDeleteUninstall: '', - aysBulkDelete: '', - aysBulkDeleteThemes: '', - deleting: '', - deleteFailed: '', - pluginDeleted: '', - themeDeleted: '', - livePreview: '', - activatePlugin: '', - activateTheme: '', - activatePluginLabel: '', - activateThemeLabel: '', - activateImporter: '', - activateImporterLabel: '', - unknownError: '', - connectionError: '', - nonceError: '', - pluginsFound: '', - noPluginsFound: '', - autoUpdatesEnable: '', - autoUpdatesEnabling: '', - autoUpdatesEnabled: '', - autoUpdatesDisable: '', - autoUpdatesDisabling: '', - autoUpdatesDisabled: '', - autoUpdatesError: '' - }; - - wp.updates.l10n = window.wp.deprecateL10nObject( 'wp.updates.l10n', wp.updates.l10n, '5.5.0' ); - /** * User nonce for ajax calls. * diff --git a/src/wp-includes/script-loader.php b/src/wp-includes/script-loader.php index 42d42b3f8781d..8a9865cab8e65 100644 --- a/src/wp-includes/script-loader.php +++ b/src/wp-includes/script-loader.php @@ -1488,7 +1488,7 @@ function wp_default_scripts( $scripts ) { $scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 ); $scripts->set_translations( 'privacy-tools' ); - $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'common', 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize', 'wp-i18n' ), false, 1 ); + $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize', 'wp-i18n' ), false, 1 ); $scripts->set_translations( 'updates' ); did_action( 'init' ) && $scripts->localize( 'updates',