• Resolved jskrajna

    (@jskrajna)


    I’m actually not sure in which plugin there is the problem, but I wanted to trasnalte mateboxes with polylang. And it seems like even if I am filling fields for both english and original languge they are just updated. Has anyone similar problem? I read somewhere that polylang is compatibile with cmb2 but maybe it’s not?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    As long as Polylang can be pointed to, or find, values in the post/user/term meta tables or options in the option_values table, then it theoretically would be compatible.

    If you’re looking to translate the default text strings that come with CMB2, there should be a pot file available for what parts we hardcode.

    Otherwise since we’re a library it’s mostly dependent on the users to pass in their own strings, so it ends up being dependent on the user to provide their own internationalization-ready strings as part of their config.

    Thread Starter jskrajna

    (@jskrajna)

    Thank you for the answer. So I would probably have a look about it in polylang documentation. But anaway, is there a plugin you know and can recommend that for sure goes well with cmb2? I couldn’t find many information about that.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    A plugin in terms of internationalization? Really they’re all going to face the same issues and hurdles on the topic since metaboxes store strings in the database as opposed to in PHP files that can be programmatically processed and switched out.

    Thread Starter jskrajna

    (@jskrajna)

    Ok, thank you ??

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome.

    Thread Starter jskrajna

    (@jskrajna)

    Me again ?? Sorry for bother you once again, but I did a little test. ACF is also using metaboxes right? When I use it everything goes well, all the data goes to wp_postmeta and there are two records for the same meta_key in database. When I use CMB2 the value only updates. I wonder if there can be something wrong with my code for cmb2 boxes that prevents it from making another record. I really don’t wont to transfer to ACF couse I really love working with CMB2. Any thoughts appreaciated.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Nope, nothing wrong with CMB2 in that regard. ACF does it that way for reasons I don’t know technical details about, but for how they work internally. It was a conscious decision they made.

    Much like the default out-of-box custom field metabox, CMB2 only needs one row in the wp_postmeta table to save to for its fields. Some of the field types will may use 2, but something like just a “text” field in CMB2 only needs the one.

    There is the wpml-config.xml file where you can specify how to handle post meta translation. You can choose between ‘translate’, ‘copy’ or ‘ignore’ for each custom field. For more info see Polylang Documentation.

    Also, make sure Custom Field checkbox is unchecked at Languages → Settings → Synchronization.

    pll_copy_post_metas and pll_translate_post_meta filters also can be useful.

    • This reply was modified 4 years, 10 months ago by maxoud.
    • This reply was modified 4 years, 10 months ago by maxoud.
    • This reply was modified 4 years, 10 months ago by maxoud. Reason: Corrected the mistake
    • This reply was modified 4 years, 10 months ago by maxoud.
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘cmb2 compatible with polylang?’ is closed to new replies.