Multilingual sites duplicating regions

Hi,

I downloaded a Spanish language package from Wordpress itself, as to make my site in Spanish as default. English remains installed as well.

It seems Hivepress automatically changes to Spanish in the frontend when I set Spanish as default.

  1. Is this correct?
  2. Can this be disabled and leave Hivepress and all its extensions in English?

If the answer to 1 is “no”, I would need a snippet to get the listings associated to a region. Or a snippet to get a region with its associated listings. At least, I need to be able to reference a “region” object, so I can extract and manipulate its data.

The problem is that besides installing the language package, I installed Translatepress, so visitors can switch from English to Spanish. When a vendor publishes a listing using the website in English, its location and associated regions are created in English (Madrid, Madrid, Spain). If another vendor uploads a listing in a similar location but in Spanish, the location and regions are now in Spanish (Madrid, Madrid, España). So there are 2 regions created for the same location, one in English, one in Spanish.

When a visitor searches listings in English he only gets listings associated to English regions. If in Spanish, only the listings in the Spanish regions appear, even that in fact the region/location is the same.

I would like to access the region from a listing in the backend and add the listing to a second region. Is this possible somehow? Is there some “region” object that I can call and use?

Thanks!

Hi,

  1. Unfortunately, there is no such option, since WordPress localization is created in such a way that the translation functions (into which all strings in the code are wrapped) are automatically translated into the language specified in the settings.

  2. Sorry for the inconvenience, it’s more likely due to incompatibility with this third-party plugin, as we don’t have integration yet. We plan to add WPML and maybe TranslatePress integration as soon as possible. In this case, as a temporary solution, please check if they have an option to exclude taxonomy (hp_listing_region) from duplication because HivePress does not create two regions, only one, and it is most likely duplicated in TranslatePress.

I hope it helps

Hi

  1. Okay
  2. Yeah, it’s not a Hivepress problem. I am aware. I tried excluding taxonomies but that doesn’t work (only selectors). That’s why I would like to see if I can modify the Hivepress code myself accessing the “regions” template/object, or however it is coded. There must be a way to access those regions, like $listing->get_regiions()…or $region->get_listings() or something, no?

This issue may be related to the map provider, it may occur if their (e.g. Google Maps or Mapbox) API returns different region IDs for different languages. Please check “hp_code” meta in wp_termmeta table for the duplicated regions, if these codes are different then this is related to the map provider indeed. This code is used for detecting regions (since some regions on different levels may have the same label), and if there’s no region with the fetched code, HivePress creates a new one. If you’re familiar with coding, this is where this code is set for a newly created region hivepress-geolocation/includes/components/class-geolocation.php at master · hivepress/hivepress-geolocation · GitHub

Hope this helps

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.