0

I'm not sure if this is feasible, or how to go about it. I want a dropdown (and use IP detection) to provide users with content based on Region - Not Language. Because we will Also be using the normal Language functionality in Drupal 8 to provide translated content, if they choose to read it in another language. Because languages and countries are not synonymous.

I want the same functionality that's in language filtering, where a user can select "Spain" from a dropdown field and they get page content and blocks that are related to the region. Then, if they desire, also an ability to filter by language.

Here's a scenario:

  1. User, in the U.S., goes to Website.com They see content that is related to the general global market, in English because they were auto-detected as a U.S. based IP.

  2. User chooses Sweden from the dropdown. Page reloads as Website.com/Sweden/English (or maybe just website.com/Sweden ?) Now home page reloads the page, with content specific to Sweden. Similar to how language filters.. but filtered BY COUNTRY.

  3. Now, the user DOES want to change the language. They choose Swedish from a second "language" dropdown on the page, and the home page reloads again with Sweden-related content, translated into Swedish, with this url. website.com/Sweden/Swedish

Any thoughts on this? I know the language modules can do half of this, but how do I also provide a way for the user to view site content by region. I know views can do some of this, but I'm not sure Views is the appropriate way to present the Entire website.

Maybe someone can clear my head on this.

  • What is the Drupal version that you are using? – Hodba Khalaf Aug 19 at 18:12
  • I'm using Drupal 8.7.5. – turpentyne Aug 19 at 20:11
0

This is a really broad and quite opinion-based request. But what I'd suggest is you completely keep Drupal's core internationalization functionality and just add languages including their region subtag:

  • es-AR
  • es-ES
  • es-MX
  • ...

You then can decide to use just the region as their label, which will then be displayed by the built-in language switcher.

A really positive side effect of this is you'd already have your content optimized for SEO pretty well (given that the region specific content actually are translations of each other).

Resources


Another approach would be to just go for one Drupal language and instead introduce a new field "Region" or "Country" to the node type you need this filtering for and build your own View with filters to display nodes or teasers of nodes matching the selected country or region.

  • I had hoped, for a moment to do exactly what you describe in the first approach... the problem is, I'd need to include options like en-ES, en-MX, etc. for english... which don't really exist, and I imagine it might create way too many node versions. – turpentyne Aug 15 at 20:28
  • @turpentyne – Uh yes, I see. Thought you maybe have just a limited set of possibilities... – leymannx Aug 15 at 20:52
  • Our team has revisited this topic. We think what @leymannx first suggested - just using the system as it is, may work... but... how do we provide English for each region? There is no es-EN for something like Spain, in English. .... or is there? Maybe a custom language we can add? – turpentyne Aug 23 at 19:06
  • @turpentyne - That would be en-ES. For English speaking people in Spain. First the language tag and then the region subtag. – leymannx Aug 23 at 20:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.