【问题标题】:wordpress does not translate my footer when changing language更改语言时,wordpress 不翻译我的页脚
【发布时间】:2020-11-29 09:55:15
【问题描述】:

很好,我想翻译我的页脚,当用户更改我的 wordpress 的语言时,页脚以英语或西班牙语放置,文本被翻译,而不使用插件,那么我想知道如何翻译该文本字符串根据语言。

我使用 material-admin 主题来设计我的管理仪表板

admin-footer.php

*/
    do_action( 'in_admin_footer' );
    ?>
    <p id="footer-left" class="alignleft">
        <?php
        $text = __( 'Desarrollado por Solutto Labs - Contact Us  <a href="%s">support@soluttoconsulting.com</a>' );

        /**
         * Filters the "Thank you" text displayed in the admin footer.
         *
         * @since 2.8.0
         *
         * @param string $text The content that will be printed.
         */
        echo apply_filters( 'admin_footer_text', '<span id="footer-thankyou">' . $text . '</span>' );
        ?>
    </p>
    <p id="footer-upgrade" class="alignright">
        <?php
        /**
         * Filters the version/update text displayed in the admin footer.
         *
         * WordPress prints the current version and update information,
         * using core_update_footer() at priority 10.
         *
         * @since 2.3.0
         *
         * @see core_update_footer()
         *
         * @param string $content The content that will be printed.
         */
        echo apply_filters( 'update_footer', '' );
        ?>
    </p>
    <div class="clear"></div>
</div>

mtrl-functions.php

//change admin footer text
function mtrl_footer_admin () {
    
    /**
     * Change footer 
     * @solutto
     * by cesar
     * Since 31-07-2020
     */

    
    echo __( 'Desarrollado por Solutto Labs - Contactenos <a href="%s">support@soluttoconsulting.com</a>' );
}

【问题讨论】:

标签: php html wordpress custom-wordpress-pages


【解决方案1】:

它是用以下代码制作的

function mtrl_footer_admin () {
    
    $lang = get_locale();
    //var_dump($lang);
    if( $lang == 'en_US' || $lang == 'en_GB' ) {
        $text = __( 'By Solutto Labs - Contact Us <a href="mailto:support@soluttoconsulting.com">support@sollutoconsulting.com</a>', 'DOMINIO_AQUI' );
    } elseif( $lang == 'es_ES' ) {
        $text = __( 'Desarrollado por Solutto Labs - Contactenos <a href="mailto:support@soluttoconsulting.com">support@sollutoconsulting.com</a>', 'www.soluttoconsulting.com' );
    } else {
        $text = __( 'By Solutto Labs - Contact Us <a href="mailto:support@soluttoconsulting.com">support@sollutoconsulting.com</a>', 'DOMINIO_AQUI' );
    }
    
    echo $text;
    
    //echo __( 'Developed by Solutto Labs - <a href="mailto:support@soluttoconsulting.com">support@sollutoconsulting.com</a>', 'www.soluttoconsulting.com' );
}

【讨论】:

    猜你喜欢
    • 2020-07-06
    • 1970-01-01
    • 2022-07-28
    • 2020-12-20
    • 1970-01-01
    • 1970-01-01
    • 2016-06-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多