• Resolved paulocarrasco

    (@paulocarrasco)


    Hi there!

    While translating your plugin to portuguese (can send you the PO file if you want), I’ve come across with two problems in the metabox.php file:
    a) This string isn’t translatable
    ‘title’ => ‘Restrict this content’,

    b) all the translations in this variable don’t get replaced by the translation string:

    $rc_meta_box = array(
        'id' => 'rcMetaBox',
        'title' => 'Restrict this content',
        'context' => 'normal',
        'priority' => 'high',
        'fields' => array(
            array(
                'name' => __('User Level', 'restrict-content'),
                'id' => 'rcUserLevel',
                'type' => 'select',
                'desc' => __('Choose the user level that can see this page / post', 'restrict-content'),
                'options' => array('None', 'Administrator', 'Editor', 'Author', 'Contributor', 'Subscriber'),
                'std' => 'None'
            ),
            array(
            	'name' => __('Hide from Feed?', 'restrict-content'),
            	'id' => 'rcFeedHide',
            	'type' => 'checkbox',
            	'desc' => __('Hide the excerpt of this post / page from the Feed?', 'restrict-content'),
            	'std' => ''
         	)
        )
    );

    All the other strings are translated and well replaced, after being translated. What can it be?

    Best Regards,

    Paulo

    https://ww.wp.xz.cn/plugins/restrict-content/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter paulocarrasco

    (@paulocarrasco)

    Guess i’ve found out the problem.

    You are initializing the variable $rc_meta_box BEFORE ou declare it in the rcAddBetaBoxes() function!

    <?php
    
    /*******************************************
    * Restrict Content Meta Box
    *******************************************/
    
    $rc_meta_box = array(
        'id' => 'rcMetaBox',
        'title' => 'Restrict this content',
        'context' => 'normal',
        'priority' => 'high',
        'fields' => array(
            array(
                'name' => __('User Level', 'restrict-content'),
                'id' => 'rcUserLevel',
                'type' => 'select',
                'desc' => __('Choose the user level that can see this page / post', 'restrict-content'),
                'options' => array('None', 'Administrator', 'Editor', 'Author', 'Contributor', 'Subscriber'),
                'std' => 'None'
            ),
            array(
            	'name' => __('Hide from Feed?', 'restrict-content'),
            	'id' => 'rcFeedHide',
            	'type' => 'checkbox',
            	'desc' => __('Hide the excerpt of this post / page from the Feed?', 'restrict-content'),
            	'std' => ''
         	)
        )
    );
    
    // Add meta box
    
    function rcAddMetaBoxes() {
            global $rc_meta_box;
    	$post_types = get_post_types(array('public' => true, 'show_ui' => true), 'objects');
    	foreach ($post_types as $page)
        add_meta_box($rc_meta_box['id'], $rc_meta_box['title'], 'rcShowMetaBox', $page->name, $rc_meta_box['context'], $rc_meta_box['priority']);
    }
    add_action('admin_menu', 'rcAddMetaBoxes');

    Putting the $rc_meta_box initialization inside the rcAddMetaBoxes() function, after the global $rc_meta_box; declaration makes the translation work! 🙂

    Hope you can fix it soon in the next update!

    Best regards,

    Paulo

    Thread Starter paulocarrasco

    (@paulocarrasco)

    By the way, this line needs also to be translatable:

    'options' => array('None', 'Administrator', 'Editor', 'Author', 'Contributor', 'Subscriber'),

    best regards,

    Paulo

    Sorry for missing this post. I’ll get these fixed asap!

    An update is going out now that fixes this.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Translation problems’ is closed to new replies.