Changeset 7057
- Timestamp:
- 04/06/2018 10:34:48 PM (9 years ago)
- Location:
- sites/trunk/wp15.wordpress.net/public_html/content
- Files:
-
- 4 edited
-
mu-plugins/assets/locale-switcher.js (modified) (4 diffs)
-
mu-plugins/locales.php (modified) (3 diffs)
-
themes/twentyseventeen-wp15/header.php (modified) (1 diff)
-
themes/twentyseventeen-wp15/style.css (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wp15.wordpress.net/public_html/content/mu-plugins/assets/locale-switcher.js
r6941 r7057 1 2 ( function( window, $ ) {1 /* global wpCookies */ 2 ( function( window, $, wpCookies ) { 3 3 4 4 'use strict'; … … 10 10 $switcher: $(), 11 11 12 $notice: $(), 13 12 14 init: function() { 13 15 app.$switcher = $( '#wp15-locale-switcher' ); 16 app.$notice = $( '.wp15-locale-notice' ); 14 17 15 18 app.$switcher.select2( { … … 21 24 $(this).parents( 'form' ).submit(); 22 25 } ); 26 27 app.$notice.on( 'click', '.wp15-locale-notice-dismiss', function( event ) { 28 event.preventDefault(); 29 app.dismissNotice(); 30 } ); 31 }, 32 33 dismissNotice: function() { 34 app.$notice.fadeTo( 100, 0, function() { 35 app.$notice.slideUp( 100, function() { 36 app.$notice.remove(); 37 }); 38 }); 39 40 wpCookies.set( 41 'wp15-locale-notice-dismissed', 42 true, 43 app.cookie.expires, 44 app.cookie.cpath, 45 app.cookie.domain, 46 app.cookie.secure 47 ); 23 48 } 24 49 } ); … … 28 53 } ); 29 54 30 } )( window, jQuery );55 } )( window, jQuery, wpCookies ); -
sites/trunk/wp15.wordpress.net/public_html/content/mu-plugins/locales.php
r7039 r7057 58 58 'locale-switcher', 59 59 WP_CONTENT_URL . '/mu-plugins/assets/locale-switcher.js', 60 array( 'jquery', 'select2' ),60 array( 'jquery', 'select2', 'utils' ), 61 61 1, 62 62 true … … 69 69 'locale' => get_locale(), 70 70 'dir' => is_rtl() ? 'rtl' : 'ltr', 71 'cookie' => array( 72 'expires' => YEAR_IN_SECONDS, 73 'cpath' => SITECOOKIEPATH, 74 'domain' => '', 75 'secure' => true, 76 ) 71 77 ) 72 78 ); … … 149 155 wp_enqueue_script( 'locale-switcher' ); 150 156 } 157 158 /** 159 * Prints markup for a notice when a locale isn't fully translated. 160 */ 161 function locale_notice() { 162 $current_locale = get_locale(); 163 $status = get_option( 'wp15_locale_status', array() ); 164 $threshold = 90; 165 $is_dismissed = ! empty( $_COOKIE['wp15-locale-notice-dismissed'] ); 166 167 if ( isset( $status[ $current_locale ] ) && absint( $status[ $current_locale ] ) <= $threshold && ! $is_dismissed ) : ?> 168 <div class="wp15-locale-notice"> 169 <p> 170 <?php 171 printf( 172 wp_kses_post( __( 'The translation for this locale is incomplete. Help us get to 100%% by <a href="%s">contributing a translation</a>.', 'wp15' ) ), 173 esc_url( sprintf( 174 'https://translate.wordpress.org/projects/meta/wp15/%s/default', 175 strtolower( str_replace( '_', '-', $current_locale ) ) 176 ) ) 177 ); 178 ?> 179 </p> 180 <button type="button" class="wp15-locale-notice-dismiss"> 181 <span class="screen-reader-text"><?php _e( 'Dismiss this notice.' ); ?></span> 182 </button> 183 </div> 184 <?php endif; 185 } -
sites/trunk/wp15.wordpress.net/public_html/content/themes/twentyseventeen-wp15/header.php
r7031 r7057 43 43 <div class="site-content-contain"> 44 44 <div id="content" class="site-content"> 45 46 <?php Locales\locale_notice(); ?> -
sites/trunk/wp15.wordpress.net/public_html/content/themes/twentyseventeen-wp15/style.css
r7056 r7057 63 63 } 64 64 65 .site-header:before, 66 .site-header:after { 67 content: none; 68 } 69 65 70 @supports( display: grid ) { 66 71 .site-header { … … 302 307 } 303 308 309 .wp15-locale-notice { 310 background: #fafafa; 311 margin-bottom: 5px; 312 padding: 1px 38px 1px 12px; 313 position: relative; 314 text-align: center; 315 } 316 317 .wp15-locale-notice p { 318 margin: 0.5em 0; 319 padding: 2px; 320 } 321 322 .wp15-locale-notice-dismiss:before { 323 background: none; 324 color: #333; 325 content: "\f153"; 326 display: block; 327 font: normal 16px/20px dashicons; 328 speak: none; 329 margin: 0.5em 0; 330 height: 20px; 331 text-align: center; 332 width: 20px; 333 -webkit-font-smoothing: antialiased; 334 -moz-osx-font-smoothing: grayscale; 335 } 336 337 .wp15-locale-notice-dismiss { 338 position: absolute; 339 top: 0; 340 right: 1px; 341 border: none; 342 margin: 0; 343 padding: 7px; 344 background: none; 345 color: #333; 346 cursor: pointer; 347 } 348 349 .wp15-locale-notice-dismiss:hover, 350 .wp15-locale-notice-dismiss:active, 351 .wp15-locale-notice-dismiss:focus { 352 background: inherit; 353 } 354 355 .wp15-locale-notice-dismiss:hover:before, 356 .wp15-locale-notice-dismiss:active:before, 357 .wp15-locale-notice-dismiss:focus:before { 358 color: #0073AA; 359 } 360 361 .wp15-locale-notice-dismiss:focus { 362 outline: none; 363 } 364 365 .ie8 .wp15-locale-notice-dismiss:focus { 366 outline: 1px solid #5b9dd9; 367 } 304 368 305 369 /*
Note:
See TracChangeset
for help on using the changeset viewer.