Join our new community forum for support & discussion

Join Now

Home Support General HivePress Listing Attributes translation in Multillingual Site with Polylang

Listing Attributes translation in Multillingual Site with Polylang

  • Author
    Posts
  • Bogdan

    Hi Ihor, do you have any idea, how to translate Listing Attributes in multilingual environment? I use Polylang and everything works well up to now. I don’t allow front-end edition.
    Pages, Posts, Listings, Categories, Widgets are available to translate, all Hive widgets are translated, but Polylang doesn’t provide Attributes translation. I can’t add another attributes in additional language, because I use it also for filtering and I will have the same attribute twice on filter widget – in two different languages.

    ihor developer

    Please check if Attributes are available as a custom post type, since attributes are not static (like strings) they should be available for translation in the same way as Listings. They may also be hidden since it’s not a public post type, please check if Polylang requires this.

    Bogdan

    Listings are available in custom post types and Categories are available as a custom taxonomies. Attributes are not there.
    Information from Polylang Support:
    Note: To correctly display the languages columns and metabox for custom post types and taxonomies, plugins or theme authors must use the same actions and filters as WordPress. Otherwise there is now way for Polylang to add its own interface.

    Note for developpers: By default, Polylang displays the post types and taxonomies in the settings for which the parameter ‘public’ is set to true. Other won’t appear. You can use the wpml-config.xml file or the filters ‘pll_get_post_types’ and ‘pll_get_taxonomies’ to change that.

    Can you change it to ‘public’ or I can change anything?

    ihor developer

    This is a private post type so unfortunately there’s no easy way to turn it public (you can do this via the hivepress/v1/post_types filter but this would enable front-end pages for attributes which may break something). Please consider adjusting the Polylang config instead (as suggested in their docs).

    Bogdan

    Ihor, I have created wpml-config.xml according the doc: https://polylang.pro/doc/the-wpml-config-xml-file/ and load it to root directory of hivepress plugin (also to polylang directory)
    <wpml-config>
    <taxonomies>
    <taxonomy translate=”1″>Attributes</taxonomy>
    </taxonomies>
    </wpml-config>
    Nothing happened.
    What is the taxonomy name for Attributes? Is Attributes ok as used above?

    ihor developer

    The post type (not taxonomy) is hp_listing_attribute, for vendors it’s hp_vendor_attribute, for bookings hp_booking_attribute. Hope this helps.

    Bogdan

    Great! Thank you. Following code works:

    <wpml-config>
    <custom-types>
      <custom-type translate="1">hp_listing_attribute</custom-type>
    </custom-types>
    </wpml-config>

    One more question. I need to translate also Options for Listing Attributes. What id should I use here?

    ihor developer

    Thanks for posting the solution! Attribute options are registered as taxonomy terms of “hp_listing_{attribute_name}” taxonomy, so these also should be available for translation.

    Bogdan

    Ihor, I have translation for Attributes in the Attributes list, but there is important issue:
    There are both language versions of the same Attribute on the Listing page
    as well as on the Filter page. It means every Attribute, doesn’t matter what language, is visible in all lanuages – https://www.golf4camper.eu/cs/listing-category/18-or-more/

    I believe this is already HP plugin functionality. Is it difficult to repair this “bug”?
    I also believe, when you fix this issue, Polylang could be officially compatible with HP. I can also test it for you in any other area.

    ihor developer

    Thanks for your feedback and for testing this, declaring the multilanguage support would be awesome. Please try adding this code to a list of arguments at line 228 in hivepress/includes/components/class-attribute.php file:

    'suppress_filters' => false,

    It may resolve the double attribute issue.

    Bogdan

    YES! Thanks!

    I will continue with Attributes – Options

Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.