diff --git a/wp-admin/js/theme-plugin-editor.js b/wp-admin/js/theme-plugin-editor.js index 84695dfefa..71fd3c1811 100644 --- a/wp-admin/js/theme-plugin-editor.js +++ b/wp-admin/js/theme-plugin-editor.js @@ -10,17 +10,10 @@ if ( ! window.wp ) { wp.themePluginEditor = (function( $ ) { 'use strict'; - var component, TreeLinks; + var component, TreeLinks, + __ = wp.i18n.__, _n = wp.i18n._n, sprintf = wp.i18n.sprintf; component = { - l10n: { - lintError: { - singular: '', - plural: '' - }, - saveAlert: '', - saveError: '' - }, codeEditor: {}, instance: null, noticeElements: {}, @@ -75,7 +68,7 @@ wp.themePluginEditor = (function( $ ) { $( window ).on( 'beforeunload', function() { if ( component.dirty ) { - return component.l10n.saveAlert; + return __( 'The changes you made will be lost if you navigate away from this page.' ); } return undefined; } ); @@ -233,7 +226,7 @@ wp.themePluginEditor = (function( $ ) { var notice = $.extend( { code: 'save_error', - message: component.l10n.saveError + message: __( 'Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP.' ) }, response, { @@ -375,20 +368,23 @@ wp.themePluginEditor = (function( $ ) { * @return {void} */ codeEditorSettings.onUpdateErrorNotice = function onUpdateErrorNotice( errorAnnotations ) { - var message, noticeElement; + var noticeElement; component.submitButton.toggleClass( 'disabled', errorAnnotations.length > 0 ); if ( 0 !== errorAnnotations.length ) { - if ( 1 === errorAnnotations.length ) { - message = component.l10n.lintError.singular.replace( '%d', '1' ); - } else { - message = component.l10n.lintError.plural.replace( '%d', String( errorAnnotations.length ) ); - } noticeElement = component.addNotice({ code: 'lint_errors', type: 'error', - message: message, + message: sprintf( + /* translators: %s: Error count. */ + _n( + 'There is %s error which must be fixed before you can update this file.', + 'There are %s errors which must be fixed before you can update this file.', + errorAnnotations.length + ), + String( errorAnnotations.length ) + ), dismissible: false }); noticeElement.find( 'input[type=checkbox]' ).on( 'click', function() { diff --git a/wp-admin/js/theme-plugin-editor.min.js b/wp-admin/js/theme-plugin-editor.min.js index 0351c5f6e7..f50ed06d0c 100644 --- a/wp-admin/js/theme-plugin-editor.min.js +++ b/wp-admin/js/theme-plugin-editor.min.js @@ -1,2 +1,2 @@ /*! This file is auto-generated */ -window.wp||(window.wp={}),wp.themePluginEditor=function(s){"use strict";var o,t;o={l10n:{lintError:{singular:"",plural:""},saveAlert:"",saveError:""},codeEditor:{},instance:null,noticeElements:{},dirty:!1,lintErrors:[],init:function(e,t){o.form=e,t&&s.extend(o,t),o.noticeTemplate=wp.template("wp-file-editor-notice"),o.noticesContainer=o.form.find(".editor-notices"),o.submitButton=o.form.find(":input[name=submit]"),o.spinner=o.form.find(".submit .spinner"),o.form.on("submit",o.submit),o.textarea=o.form.find("#newcontent"),o.textarea.on("change",o.onChange),o.warning=s(".file-editor-warning"),o.docsLookUpButton=o.form.find("#docs-lookup"),o.docsLookUpList=o.form.find("#docs-list"),0add( 'htmlhint-kses', '/wp-includes/js/codemirror/htmlhint-kses.js', array( 'htmlhint' ) ); $scripts->add( 'code-editor', "/wp-admin/js/code-editor$suffix.js", array( 'jquery', 'wp-codemirror', 'underscore' ) ); $scripts->add( 'wp-theme-plugin-editor', "/wp-admin/js/theme-plugin-editor$suffix.js", array( 'wp-util', 'wp-sanitize', 'jquery', 'jquery-ui-core', 'wp-a11y', 'underscore' ) ); - did_action( 'init' ) && $scripts->add_inline_script( - 'wp-theme-plugin-editor', - sprintf( - 'wp.themePluginEditor.l10n = %s;', - wp_json_encode( - array( - 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ), - 'saveError' => __( 'Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP.' ), - 'lintError' => array( - /* translators: %d: Error count. */ - 'singular' => _n( 'There is %d error which must be fixed before you can update this file.', 'There are %d errors which must be fixed before you can update this file.', 1 ), - /* translators: %d: Error count. */ - 'plural' => _n( 'There is %d error which must be fixed before you can update this file.', 'There are %d errors which must be fixed before you can update this file.', 2 ), - // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491. - ), - ) - ) - ) - ); + $scripts->set_translations( 'wp-theme-plugin-editor' ); $scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 45e4416617..cff63ad52b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.5-alpha-48345'; +$wp_version = '5.5-alpha-48346'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.