【问题标题】:'poedit' translation activation'poedit' 翻译激活
【发布时间】:2018-05-14 03:15:46
【问题描述】:

我正在尝试使用“poedit”准备好我的 wordpress 网站翻译。我在激活翻译时遇到问题。我只想翻译网站,而不是 wordpress 系统。我的 .pot、.po 和 .mo 文件位于主题目录的“语言”文件夹中,我的 functions.php 文件中有此代码:

load_theme_textdomain( 'example', get_template_directory() . '/languages' );

好吧,在 poedit 程序中保存和翻译所有内容后,如何在我的站点中激活它?我现在正在使用本地主机。

【问题讨论】:

    标签: wordpress translation poedit


    【解决方案1】:

    首先,您需要将方法连接到主题functions.php中的动作挂钩:

    function load_mytheme_textdomain() {
        load_theme_textdomain( 'example', get_template_directory() . '/languages' );
    }
    add_action( 'after_setup_theme', 'load_mytheme_textdomain' );
    

    那么你必须使用翻译而不是回显来输出:

    _e( 'My Text', 'example' );
    

    在此处阅读更多信息:https://developer.wordpress.org/themes/functionality/internationalization/

    【讨论】:

      猜你喜欢
      • 2011-08-18
      • 1970-01-01
      • 2016-01-10
      • 1970-01-01
      • 1970-01-01
      • 2018-06-10
      • 1970-01-01
      • 1970-01-01
      • 2013-05-13
      相关资源
      最近更新 更多