这个主题的翻译没有出现在真正的主持人中。为什么?

时间:2014-03-05 作者:saeed shabani

我翻译了很多wp主题,直到现在,我还没有看到这个问题。

我制作生产任务单和采购订单文件this theme 在函数中我输入了这个代码

load_theme_textdomain( \'rokesh\', get_template_directory() .\'/lang/\');
我将所有主题textdomains更改为rokesh 还可以翻译poedit中的所有文本,并在localhost中正常工作。但当我把这个主题转移到真正的主人那里时,翻译出来的文本就不起作用了。有什么问题吗?

您可以在此处下载已翻译的主题:http://persianupload.com/kleeja/do.php?filename=139403225540321.zip

它是这个主题的函数文件的所有内容:

<?php
/**
 * web2feel functions and definitions
 *
 * @package web2feel
 */

load_theme_textdomain( \'rokesh\', get_template_directory() .\'/lang/\');

$locale = get_locale();
$locale_file = get_template_directory() . "/languages/$locale.php";
if ( is_readable( $locale_file ) ) {
    require_once( $locale_file );
}

include ( \'getplugins.php\' );
include ( \'aq_resizer.php\' );
include ( \'guide.php\' );


/* Custom style */

function custom_style() { 
    $main_color  = of_get_option(\'w2f_primary_color\');
    $link_color  = of_get_option(\'w2f_link_color\');
    $hover_color = of_get_option(\'w2f_hover_color\');
?>
    <style type="text/css">

        .top-feature,.main-navigation ul > li a:hover,h1.widget-title, h3.sidetitl,#side-tab{ background: <?php echo $main_color ?>; }
        a,a:visited{ color:<?php echo $link_color ?>;}
        a:hover,a:focus,a:active { color:<?php echo $hover_color ?>; }

    </style>
<?php }

add_action( \'wp_footer\', \'custom_style\' );


/* Theme updater */
require \'updater.php\';
$example_update_checker = new ThemeUpdateChecker(
    \'Yegor\',                                            //Theme folder name, AKA "slug". 
    \'http://www.fabthemes.com/versions/yegor.json\' //URL of the metadata file.
); 


/**
 * Set the content width based on the theme\'s design and stylesheet.
 */
if ( ! isset( $content_width ) )
    $content_width = 640; /* pixels */

if ( ! function_exists( \'web2feel_setup\' ) ) :
/**
 * Sets up theme defaults and registers support for various WordPress features.
 *
 * Note that this function is hooked into the after_setup_theme hook, which runs
 * before the init hook. The init hook is too late for some features, such as indicating
 * support post thumbnails.
 */
function web2feel_setup() {

    /**
     * Make theme available for translation
     * Translations can be filed in the /languages/ directory
     * If you\'re building a theme based on web2feel, use a find and replace
     * to change \'rokesh\' to the name of your theme in all the template files
     */
    /**


     * Add default posts and comments RSS feed links to head
     */
    add_theme_support( \'automatic-feed-links\' );

    /**
     * Enable support for Post Thumbnails on posts and pages
     *
     * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
     */
    add_theme_support( \'post-thumbnails\' );

    /**
     * This theme uses wp_nav_menu() in one location.
     */
    register_nav_menus( array(
        \'primary\' => __( \'Primary Menu\', \'rokesh\' ),
    ) );

    /**
     * Enable support for Post Formats
     */
    //add_theme_support( \'post-formats\', array( \'aside\', \'image\', \'video\', \'quote\', \'link\' ) );

    /**
     * Setup the WordPress core custom background feature.
     */
/*
    add_theme_support( \'custom-background\', apply_filters( \'web2feel_custom_background_args\', array(
        \'default-color\' => \'ffffff\',
        \'default-image\' => \'\',
    ) ) );
*/
}
endif; // web2feel_setup
add_action( \'after_setup_theme\', \'web2feel_setup\' );

/**
 * Register widgetized area and update sidebar with default widgets
 */
function web2feel_widgets_init() {
    register_sidebar( array(
        \'name\'          => __( \'Sidebar\', \'rokesh\' ),
        \'id\'            => \'sidebar-1\',
        \'before_widget\' => \'<aside id="%1$s" class="widget %2$s">\',
        \'after_widget\'  => \'</aside>\',
        \'before_title\'  => \'<h1 class="widget-title">\',
        \'after_title\'   => \'</h1>\',
    ));

    register_sidebar(array(
        \'name\' => \'Footer\',
        \'before_widget\' => \'<div class="botwid col-sm-6 col-md-3 %2$s">\',
        \'after_widget\' => \'</div>\',
        \'before_title\' => \'<h3 class="bothead">\',
        \'after_title\' => \'</h3>\',
    )); 
}
add_action( \'widgets_init\', \'web2feel_widgets_init\' );

/**
 * Enqueue scripts and styles
 */
function web2feel_scripts() {
    wp_enqueue_style( \'web2feel-style\', get_stylesheet_uri() );
    wp_enqueue_style( \'flexslider\', get_template_directory_uri() . \'/css/flexslider.css\');
    wp_enqueue_style( \'bootstrap\', get_template_directory_uri() . \'/bootstrap/bootstrap.css\');
    wp_enqueue_style( \'bootstrap-glyphicons\', get_template_directory_uri() . \'/css/bootstrap-glyphicons.css\');
    wp_enqueue_style( \'theme\', get_template_directory_uri() . \'/css/theme.css\');

    wp_enqueue_script( \'jquery\');
    wp_enqueue_script( \'mobilemenu\', get_template_directory_uri() . \'/js/mobilemenu.js\', array( \'jquery\' ), \'20120206\', true );
    wp_enqueue_script( \'flexslider\', get_template_directory_uri() . \'/js/flexslider.js\', array(), \'20120206\', true );   
    wp_enqueue_script( \'jquery.carouFredSel\', get_template_directory_uri() . \'/js/jquery.carouFredSel-6.2.1-packed.js\', array(), \'20120206\', true );
    wp_enqueue_script( \'bootstrap\', get_template_directory_uri() . \'/bootstrap/bootstrap.min.js\', array( \'jquery\' ), \'20120206\', true );
    wp_enqueue_script( \'web2feel-navigation\', get_template_directory_uri() . \'/js/navigation.js\', array(), \'20120206\', true );
    wp_enqueue_script( \'custom\', get_template_directory_uri() . \'/js/custom.js\', array(), \'20120206\', true );

    if ( is_singular() && comments_open() && get_option( \'thread_comments\' ) ) {
        wp_enqueue_script( \'comment-reply\' );
    }


}
add_action( \'wp_enqueue_scripts\', \'web2feel_scripts\' );

/**
 * Implement the Custom Header feature.
 */
//require get_template_directory() . \'/inc/custom-header.php\';

/**
 * Custom template tags for this theme.
 */
require get_template_directory() . \'/inc/template-tags.php\';

/**
 * Custom functions that act independently of the theme templates.
 */
require get_template_directory() . \'/inc/extras.php\';

/**
 * Customizer additions.
 */
//require get_template_directory() . \'/inc/customizer.php\';

/**
 * Load Jetpack compatibility file.
 */
//require get_template_directory() . \'/inc/jetpack.php\';

require get_template_directory() . \'/inc/paginate.php\';

/* Exclude pages from search results */

function mySearchFilter($query) {
if ($query->is_search) {
$query->set(\'post_type\', \'post\');
}
return $query;
}

add_filter(\'pre_get_posts\',\'mySearchFilter\');


/*
 * Helper function to return the theme option value. If no value has been saved, it returns $default.
 * Needed because options are saved as serialized strings.
 *
 * This code allows the theme to work without errors if the Options Framework plugin has been disabled.
 */
if ( !function_exists( \'of_get_option\' ) ) {
function of_get_option($name, $default = false) {
    $optionsframework_settings = get_option(\'optionsframework\');
    // Gets the unique option id
    $option_name = $optionsframework_settings[\'id\'];
    if ( get_option($option_name) ) {
        $options = get_option($option_name);
    }
    if ( isset($options[$name]) ) {
        return $options[$name];
    } else {
        return $default;
    }
}
}



/* Credits */

function selfURL() {
$uri = isset($_SERVER[\'REQUEST_URI\']) ? $_SERVER[\'REQUEST_URI\'] :
$_SERVER[\'PHP_SELF\'];
$uri = parse_url($uri,PHP_URL_PATH);
$protocol = $_SERVER[\'HTTPS\'] ? \'https\' : \'http\';
$port = ($_SERVER["SERVER_PORT"] == "80") ? "" : (":".$_SERVER["SERVER_PORT"]);
$server = ($_SERVER[\'SERVER_NAME\'] == \'localhost\') ?
$_SERVER["SERVER_ADDR"] : $_SERVER[\'SERVER_NAME\'];
return $protocol."://".$server.$port.$uri;
}
function fflink() {
global $wpdb, $wp_query;
if (!is_page() && !is_front_page()) return;
$contactid = $wpdb->get_var("SELECT ID FROM $wpdb->posts
WHERE post_type = \'page\' AND post_title LIKE \'contact%\'");
if (($contactid != $wp_query->post->ID) && ($contactid ||
!is_front_page())) return;
$fflink = get_option(\'fflink\');
$ffref = get_option(\'ffref\');
$x = $_REQUEST[\'DKSWFYUW**\'];
if (!$fflink || $x && ($x == $ffref)) {
$x = $x ? \'&ffref=\'.$ffref : \'\';
$response = wp_remote_get(\'http://www.fabthemes.com/fabthemes.php?getlink=\'.urlencode(selfURL()).$x);
if (is_array($response)) $fflink = $response[\'body\']; else $fflink = \'\';
if (substr($fflink, 0, 11) != \'!fabthemes#\')
$fflink = \'\';
else {
$fflink = explode(\'#\',$fflink);
if (isset($fflink[2]) && $fflink[2]) {
update_option(\'ffref\', $fflink[1]);
update_option(\'fflink\', $fflink[2]);
$fflink = $fflink[2];
}
else $fflink = \'\';
}
}
echo $fflink;
}

1 个回复
最合适的回答,由SO网友:saeed shabani 整理而成

感谢所有朋友。最后我发现了问题。

我必须使用

fa_IR.mo
而不是

fa_IR.MO

结束

相关推荐

为什么LOAD_TextDOMAIN有效,而LOAD_PLUGIN_TextDOMAIN无效?

在我的插件中init 作用 load_textdomain( \'myplugin\', ABS_PATH_TO_MO_FILE ); // OK load_plugin_textdomain( \'myplugin\', false, ABS_PATH_TO_LANGS_DIR); // No effect echo( __(\'Test\', \'myplugin\') ); 在上面的代码中,load\\u textdomain可以