summaryrefslogtreecommitdiffstatshomepage
path: root/src/js/_enqueues/admin/common.js
diff options
context:
space:
mode:
authorDominik Schilling <ocean90@git.wordpress.org>2020-10-14 21:11:09 +0000
committerDominik Schilling <ocean90@git.wordpress.org>2020-10-14 21:11:09 +0000
commitd0ec93f2939a5ac6c1dccbb4114c256a9fb1215e (patch)
tree12538405b5386c3c5663b25a97a52517b47a35d3 /src/js/_enqueues/admin/common.js
parent0aa3ade1fe0e7afeb23f2df67a0d6014f074df41 (diff)
downloadwordpress-d0ec93f2939a5ac6c1dccbb4114c256a9fb1215e.tar.gz
wordpress-d0ec93f2939a5ac6c1dccbb4114c256a9fb1215e.zip
I18N: Use `wp.i18n` for translatable strings in `wp-admin/js/dashboard.js`.
* Deprecate the `l10n` property on `communityEventsData`. * Introduce `version` parameter for `deprecateL10nObject` and backfill the version for deprecated objects in 5.5.0. * Add a noop version of `deprecateL10nObject` for QUnit testing. Fixes #51498. git-svn-id: https://develop.svn.wordpress.org/trunk@49151 602fd350-edb4-49c9-b593-d223f7449a82
Diffstat (limited to 'src/js/_enqueues/admin/common.js')
-rw-r--r--src/js/_enqueues/admin/common.js40
1 files changed, 21 insertions, 19 deletions
diff --git a/src/js/_enqueues/admin/common.js b/src/js/_enqueues/admin/common.js
index ef92097f66..3832bcac2c 100644
--- a/src/js/_enqueues/admin/common.js
+++ b/src/js/_enqueues/admin/common.js
@@ -55,13 +55,15 @@ function deprecatedProperty( propName, version, replacement ) {
* 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 ) {
+function deprecateL10nObject( name, l10nObject, version ) {
var deprecatedObject = {};
Object.keys( l10nObject ).forEach( function( key ) {
@@ -70,12 +72,12 @@ function deprecateL10nObject( name, l10nObject ) {
if ( 'object' === typeof prop ) {
Object.defineProperty( deprecatedObject, key, { get: function() {
- deprecatedProperty( propName, '5.5.0', prop.alternative );
+ deprecatedProperty( propName, version, prop.alternative );
return prop.func();
} } );
} else {
Object.defineProperty( deprecatedObject, key, { get: function() {
- deprecatedProperty( propName, '5.5.0', 'wp.i18n' );
+ deprecatedProperty( propName, version, 'wp.i18n' );
return prop;
} } );
}
@@ -99,7 +101,7 @@ window.commonL10n = window.commonL10n || {
expandMenu: ''
};
-window.commonL10n = deprecateL10nObject( 'commonL10n', window.commonL10n );
+window.commonL10n = deprecateL10nObject( 'commonL10n', window.commonL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -111,7 +113,7 @@ window.wpPointerL10n = window.wpPointerL10n || {
dismiss: ''
};
-window.wpPointerL10n = deprecateL10nObject( 'wpPointerL10n', window.wpPointerL10n );
+window.wpPointerL10n = deprecateL10nObject( 'wpPointerL10n', window.wpPointerL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -129,7 +131,7 @@ window.userProfileL10n = window.userProfileL10n || {
ariaHide: ''
};
-window.userProfileL10n = deprecateL10nObject( 'userProfileL10n', window.userProfileL10n );
+window.userProfileL10n = deprecateL10nObject( 'userProfileL10n', window.userProfileL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -148,7 +150,7 @@ window.privacyToolsL10n = window.privacyToolsL10n || {
exportError: ''
};
-window.privacyToolsL10n = deprecateL10nObject( 'privacyToolsL10n', window.privacyToolsL10n );
+window.privacyToolsL10n = deprecateL10nObject( 'privacyToolsL10n', window.privacyToolsL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -160,7 +162,7 @@ window.authcheckL10n = {
beforeunload: ''
};
-window.authcheckL10n = window.authcheckL10n || deprecateL10nObject( 'authcheckL10n', window.authcheckL10n );
+window.authcheckL10n = window.authcheckL10n || deprecateL10nObject( 'authcheckL10n', window.authcheckL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -173,7 +175,7 @@ window.tagsl10n = {
broken: ''
};
-window.tagsl10n = window.tagsl10n || deprecateL10nObject( 'tagsl10n', window.tagsl10n );
+window.tagsl10n = window.tagsl10n || deprecateL10nObject( 'tagsl10n', window.tagsl10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -198,7 +200,7 @@ window.adminCommentsL10n = window.adminCommentsL10n || {
docTitleCommentsCount: ''
};
-window.adminCommentsL10n = deprecateL10nObject( 'adminCommentsL10n', window.adminCommentsL10n );
+window.adminCommentsL10n = deprecateL10nObject( 'adminCommentsL10n', window.adminCommentsL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -214,7 +216,7 @@ window.tagsSuggestL10n = window.tagsSuggestL10n || {
termRemoved: ''
};
-window.tagsSuggestL10n = deprecateL10nObject( 'tagsSuggestL10n', window.tagsSuggestL10n );
+window.tagsSuggestL10n = deprecateL10nObject( 'tagsSuggestL10n', window.tagsSuggestL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -231,7 +233,7 @@ window.wpColorPickerL10n = window.wpColorPickerL10n || {
defaultLabel: ''
};
-window.wpColorPickerL10n = deprecateL10nObject( 'wpColorPickerL10n', window.wpColorPickerL10n );
+window.wpColorPickerL10n = deprecateL10nObject( 'wpColorPickerL10n', window.wpColorPickerL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -243,7 +245,7 @@ window.attachMediaBoxL10n = window.attachMediaBoxL10n || {
error: ''
};
-window.attachMediaBoxL10n = deprecateL10nObject( 'attachMediaBoxL10n', window.attachMediaBoxL10n );
+window.attachMediaBoxL10n = deprecateL10nObject( 'attachMediaBoxL10n', window.attachMediaBoxL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -276,7 +278,7 @@ window.postL10n = window.postL10n || {
permalinkSaved: ''
};
-window.postL10n = deprecateL10nObject( 'postL10n', window.postL10n );
+window.postL10n = deprecateL10nObject( 'postL10n', window.postL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -292,7 +294,7 @@ window.inlineEditL10n = window.inlineEditL10n || {
saved: ''
};
-window.inlineEditL10n = deprecateL10nObject( 'inlineEditL10n', window.inlineEditL10n );
+window.inlineEditL10n = deprecateL10nObject( 'inlineEditL10n', window.inlineEditL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -306,7 +308,7 @@ window.plugininstallL10n = window.plugininstallL10n || {
ays: ''
};
-window.plugininstallL10n = deprecateL10nObject( 'plugininstallL10n', window.plugininstallL10n );
+window.plugininstallL10n = deprecateL10nObject( 'plugininstallL10n', window.plugininstallL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -321,7 +323,7 @@ window.navMenuL10n = window.navMenuL10n || {
untitled: ''
};
-window.navMenuL10n = deprecateL10nObject( 'navMenuL10n', window.navMenuL10n );
+window.navMenuL10n = deprecateL10nObject( 'navMenuL10n', window.navMenuL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -334,7 +336,7 @@ window.commentL10n = window.commentL10n || {
dateFormat: ''
};
-window.commentL10n = deprecateL10nObject( 'commentL10n', window.commentL10n );
+window.commentL10n = deprecateL10nObject( 'commentL10n', window.commentL10n, '5.5.0' );
/**
* Removed in 5.5.0, needed for back-compatibility.
@@ -349,7 +351,7 @@ window.setPostThumbnailL10n = window.setPostThumbnailL10n || {
done: ''
};
-window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n );
+window.setPostThumbnailL10n = deprecateL10nObject( 'setPostThumbnailL10n', window.setPostThumbnailL10n, '5.5.0' );
/**
* Removed in 3.3.0, needed for back-compatibility.