WordPress在数组中翻译字符串

时间:2013-10-03 10:19:46

标签: arrays wordpress localization translation

我创建了一个WordPress主题选项页面,其中所有选项/设置都在一个数组中。现在,数组中的字符串拒绝翻译。

如何获取它以便我的数组中的字符串将被翻译?

// create theme options
global $cc_options;
$cc_options = array (

// General settings
    array(  'name'      => __('General', 'cc_language'),
            'slug'      => 'general',
            'status'    => 'active',
            'type'      => 'section'),

    array(  'name'      => __('Setup some general settings for the website.', 'cc_language'),
            'type'      => 'section_desc'),

    array(  'type'      => 'open'),

    array(  'name'      => __('Breadcrumbs', 'cc_language'),
            'type'      => 'section_category'),

    array(  'name'      => __('Enable breadcrumbs', 'cc_language'),
            'desc'      => __('Check to enable breadcrumbs on pages and posts.', 'cc_language'),
            'id'        => 'breadcrumbs',
            'type'      => 'checkbox',
            'std'       => 'true'),

    array(  'type'      => 'close'),    
);

1 个答案:

答案 0 :(得分:3)

你需要在wordpress使其翻译例程初始化后定义你的选项数组。尝试将声明放在init动作挂钩中。