food-and-drink-menu icon indicating copy to clipboard operation
food-and-drink-menu copied to clipboard

Add wpml/polyang support (wpml-config.xml)

Open strarsis opened this issue 6 years ago • 3 comments

wpml-config.xml for plugin/theme is loaded automatically by wpml/polylang:

<wpml-config>
    <custom-fields>
        <custom-field action="translate">fdm_item_price</custom-field>
        <custom-field action="translate">fdm_menu_column_one</custom-field>
        <custom-field action="translate">fdm_menu_column_two</custom-field>
        <custom-field action="translate">fdm_menu_footer_content</custom-field>
    </custom-fields>

    <custom-types>
        <custom-type translate="1">fdm-menu</custom-type>
        <custom-type translate="1">fdm-menu-item</custom-type>
    </custom-types>

    <taxonomies>
      <taxonomy translate="1">fdm-menu-section</taxonomy>
    </taxonomies>
</wpml-config>

strarsis avatar Jun 19 '18 12:06 strarsis

Can you describe in more detail the problem that you're raising and the change you're proposing?

NateWr avatar Jun 20 '18 09:06 NateWr

I can see that this makes a couple of changes to the existing wpml-config.xml file:

  1. It adds fdm_item_price to the custom-fields list with instructions to translate.
  2. It changes fdm_menu_column_one and fdm_menu_column_two from copy to translate.

For (1), I have deliberately left this open, because some users want to copy and some users want to translate. Leaving it unspecified will let you configure the behaviour you want in WPML.

For (2), I don't think translate is the right action. I believe copy is more appropriate, as the layout doesn't typically change from one language to another.

I'll close this as wontfix for now, but feel free to reopen if you want to press the case for either change.

NateWr avatar Jun 21 '18 08:06 NateWr

@NateWr: Apparently it is necessary to translate fdm_menu_column_one and fdm_menu_column_two because Polylang creates a different post (with different ID) for each translation (language). Hence copying these fields instead of independently translating them results in the menu columns being cleared in the other translations.

Related issue: https://github.com/NateWr/food-and-drink-menu/issues/50

strarsis avatar Sep 05 '18 12:09 strarsis