Changeset 48346
- Timestamp:
- 07/06/2020 07:33:54 PM (5 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/js/_enqueues/wp/theme-plugin-editor.js
r47122 r48346 11 11 wp.themePluginEditor = (function( $ ) { 12 12 'use strict'; 13 var component, TreeLinks; 13 var component, TreeLinks, 14 __ = wp.i18n.__, _n = wp.i18n._n, sprintf = wp.i18n.sprintf; 14 15 15 16 component = { 16 l10n: {17 lintError: {18 singular: '',19 plural: ''20 },21 saveAlert: '',22 saveError: ''23 },24 17 codeEditor: {}, 25 18 instance: null, … … 76 69 $( window ).on( 'beforeunload', function() { 77 70 if ( component.dirty ) { 78 return component.l10n.saveAlert;71 return __( 'The changes you made will be lost if you navigate away from this page.' ); 79 72 } 80 73 return undefined; … … 234 227 { 235 228 code: 'save_error', 236 message: component.l10n.saveError229 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.' ) 237 230 }, 238 231 response, … … 376 369 */ 377 370 codeEditorSettings.onUpdateErrorNotice = function onUpdateErrorNotice( errorAnnotations ) { 378 var message,noticeElement;371 var noticeElement; 379 372 380 373 component.submitButton.toggleClass( 'disabled', errorAnnotations.length > 0 ); 381 374 382 375 if ( 0 !== errorAnnotations.length ) { 383 if ( 1 === errorAnnotations.length ) {384 message = component.l10n.lintError.singular.replace( '%d', '1' );385 } else {386 message = component.l10n.lintError.plural.replace( '%d', String( errorAnnotations.length ) );387 }388 376 noticeElement = component.addNotice({ 389 377 code: 'lint_errors', 390 378 type: 'error', 391 message: message, 379 message: sprintf( 380 /* translators: %s: Error count. */ 381 _n( 382 'There is %s error which must be fixed before you can update this file.', 383 'There are %s errors which must be fixed before you can update this file.', 384 errorAnnotations.length 385 ), 386 String( errorAnnotations.length ) 387 ), 392 388 dismissible: false 393 389 }); -
trunk/src/wp-includes/script-loader.php
r48340 r48346 1014 1014 $scripts->add( 'code-editor', "/wp-admin/js/code-editor$suffix.js", array( 'jquery', 'wp-codemirror', 'underscore' ) ); 1015 1015 $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' ) ); 1016 did_action( 'init' ) && $scripts->add_inline_script( 1017 'wp-theme-plugin-editor', 1018 sprintf( 1019 'wp.themePluginEditor.l10n = %s;', 1020 wp_json_encode( 1021 array( 1022 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ), 1023 '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.' ), 1024 'lintError' => array( 1025 /* translators: %d: Error count. */ 1026 '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 ), 1027 /* translators: %d: Error count. */ 1028 '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 ), 1029 // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491. 1030 ), 1031 ) 1032 ) 1033 ) 1034 ); 1016 $scripts->set_translations( 'wp-theme-plugin-editor' ); 1035 1017 1036 1018 $scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
Note: See TracChangeset
for help on using the changeset viewer.