WordPress.org

Make WordPress Core

Ticket #43632: 43632.5.diff

File 43632.5.diff, 1.6 KB (added by audrasjb, 13 months ago)

Previous changes + translatable string

  • src/wp-content/plugins/hello.php

    diff --git a/src/wp-content/plugins/hello.php b/src/wp-content/plugins/hello.php
    index 34e3b68..5c5e906 100644
    a b Description: This is not just a plugin, it symbolizes the hope and enthusiasm of 
    1010Author: Matt Mullenweg
    1111Version: 1.7
    1212Author URI: http://ma.tt/
     13Text Domain: hello-dolly
    1314*/
    1415
    1516function hello_dolly_get_lyric() {
    Dolly'll never go away again"; 
    5253// This just echoes the chosen line, we'll position it later
    5354function hello_dolly() {
    5455        $chosen = hello_dolly_get_lyric();
    55         echo "<p id='dolly'>$chosen</p>";
     56        $lang = "";
     57        if ( false === strpos( get_user_locale(), 'en_' ) ) {
     58                $lang = "lang='en'";
     59        }
     60        echo "<p id='dolly' $lang><span class='screen-reader-text'>" . __( 'Quote from Hello Dolly song:', 'hello-dolly' ) . " </span>$chosen</p>";
    5661}
    5762
    5863// Now we set that function up to execute when the admin_notices action is called
    add_action( 'admin_notices', 'hello_dolly' ); 
    6065
    6166// We need some CSS to position the paragraph
    6267function dolly_css() {
    63         // This makes sure that the positioning is also good for right-to-left languages
    64         $x = is_rtl() ? 'left' : 'right';
    65 
    6668        echo "
    6769        <style type='text/css'>
    6870        #dolly {
    69                 float: $x;
    70                 padding-$x: 15px;
    71                 padding-top: 5px;               
     71                float: right;
     72                padding: 6px 10px 4px 0;
    7273                margin: 0;
     74                line-height: 1.7;
    7375                font-size: 11px;
    7476        }
     77        body.rtl #dolly {
     78                float: left;
     79                padding: 6px 0 4px 10px;
     80        }
     81        @media screen and (max-width: 782px) {
     82                #dolly {
     83                        float: none;
     84                }
     85        }
    7586        </style>
    7687        ";
    7788}
    7889
    7990add_action( 'admin_head', 'dolly_css' );
    80 
    81