1

我购买了一个 .pot 语言文件位于以下路径的 WordPress 主题:

    ./wp-content/themes/THEME_NAME/include/languages/THEME_NAME.pot

我已经用 Poedit 软件翻译了一些短语并替换了新的 .pot 文件;但是对结果没有影响!!所有短语仍为默认语言!

请注意我已将以下代码放入 wp-config.php 文件:

    define('WPLANG', 'language_COUNTRY');

并且模板本身还有一个选项,它禁用小型管理端翻译器并启用 .pot 文件以获取所有短语的工作;我已经在这里切换到 .pot 文件。

我还在文件名和文件路径上做了一些尝试和错误,但没有成功。实际上,我已经将其命名为其他一些东西以及其他一些文件扩展名并更改了文件位置:

    ./wp-content/themes/THEME_NAME/include/languages/language_COUNTRY.pot & .po & .mo
    ./wp-content/themes/THEME_NAME/include/languages/THEME_NAME-language_COUNTRY.pot & .po & .mo

    ./wp-content/themes/THEME_NAME/language_COUNTRY.pot & .po & .mo
    ./wp-content/themes/THEME_NAME/THEME_NAME-language_COUNTRY.pot & .po & .mo

    ./wp-content/languages/language_COUNTRY.pot & .po & .mo
    ./wp-content/languages/THEME_NAME-language_COUNTRY.pot & .po & .mo

    ./wp-content/languages/themes/language_COUNTRY.pot & .po & .mo
    ./wp-content/languages/themes/THEME_NAME-language_COUNTRY.pot & .po & .mo

    ./language_COUNTRY.pot & .po & .mo
    ./THEME_NAME-language_COUNTRY.pot & .po & .mo

在以下路径的 PHP 文件中使用了“load_theme_textdomain”函数:

    ./wp-content/themes/THEME_NAME/include/function-regist.php

代码的相关部分是:

    // enable theme to support the localization
    add_action('init', 'gdl_word_translation');
    function gdl_word_translation(){
        global $gdl_admin_translator;
        if( $gdl_admin_translator == 'disable' ){
            load_theme_textdomain( 'gdl_back_office', SERVER_PATH . '/include/languages/' );
            load_theme_textdomain( 'gdl_front_end', SERVER_PATH . '/include/languages/' );
        }
    }

现在,我应该怎么做才能让它工作?!

4

0 回答 0