• Resolved danidada

    (@danidada)


    Hello,

    I’m using Polylang plugin for translations but on the group fields editor for the table field the translation select option is missing so I have the label “This field is ignored” when adding a translation (I would like for it to be translated or copied once)

    I have tried to add it with the filter pll_copy_post_metas:

    add_filter( ‘pll_copy_post_metas’, ‘copy_metas’, 10, 2 );
    function copy_metas( $metas ) { return array_merge( $metas, array( ‘my_table’,’_my_table’ ) );    }

    but doesn’t change anything. Printing the post meta on the published translation page I can see that field data is missing.

    Can you help me solve this?

    • This topic was modified 6 months ago by danidada.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Johann Heyne

    (@jonua)

    Hi,

    Support for Polylang will be included with the next update. I’m currently trying to implement the Polylang DeepL translation functionality.

    Meanwhile you could add the following code in your functions.php to add the basic Polylang support:

    if ( class_exists( 'Polylang' ) && function_exists( 'acf_render_field_setting' ) ) {

    add_action( 'acf/render_field_settings/type=table', function( $field ) {

    $choices = array(
    'ignore' => __( 'Ignore', 'polylang-pro' ),
    'copy_once' => __( 'Copy once', 'polylang-pro' ),
    'translate' => __( 'Translate', 'polylang-pro' ),
    'translate_once' => __( 'Translate once', 'polylang-pro' ),
    'sync' => __( 'Synchronize', 'polylang-pro' ),
    );

    $default = 'translate';

    acf_render_field_setting(
    $field,
    array(
    'label' => __( 'Translations', 'polylang-pro' ),
    'instructions' => '',
    'name' => 'translations',
    'type' => 'select',
    'choices' => $choices,
    'default_value' => $default,
    ),
    false
    );
    });
    }


    Thanks for pointing that out.
    Johann

    Thread Starter danidada

    (@danidada)

    Thank you for the fast reply!

    I added the code and set it on “Copy once” now it is in the translation as expected. Perfect!

    It’s enough for what I need. Thank you.

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

The topic ‘Translation with Polylang’ is closed to new replies.