Translating custom post type metaboxes

Question

Is it possible to translate custom post type metaboxes (label not values of metaboxes fields) with localization? Or do I have to use some plugin like WPML? Thank you in advance. I have read this Custom metabox translation but I tried with Codestyling Localization and it didn’t work so I am not sure if it is possible to translate those labels.

Edit:

I pass the array of metaboxes to the constructor:

array(
    'id' => 'rti-meta-box-1',
    'title' => __('Title Options','rti'),
    'pages' => array('post', 'page', 'courses'),
    'context' => 'advanced',
    'priority' => 'default',
    'function_callback' => 'show',
    'fields' => array(
        array(
            'name' => __('Show title?','rti'),
            'id' => $prefix . 'title_meta',
            'type' => 'checkbox',
            'std' => 1
        ),
        array(
            'name' => __('Show breadcrumbs?','rti'),
            'id' => $prefix . 'breadcrumb_meta',
            'type' => 'checkbox',
            'std' => 1
        )
    )
)

Then in the constructor function add is hooked to admin_menu where add_metabox is called. Function add looks like this:

function __construct($meta_box) {
    $this->_meta_box = $meta_box;       

    add_action('admin_menu', array(&$this, 'add')); 
    add_action('save_post',  array(&$this, 'save'));
}

/// Add meta box for multiple post types
function add() {
    foreach ($this->_meta_box['pages'] as $page) {
        add_meta_box($this->_meta_box['id'], $this->_meta_box['title'], array(&$this, $this->_meta_box['function_callback']), $page, $this->_meta_box['context'], $this->_meta_box['priority']);
    }
}

And when I translate for example Title Options it appears the same.

0
, , scarably 5 years 0 Answers 64 views 0

Leave an answer