Is it possible to have the label be a country or region name be displayed instead of the language? Given the scenario that our languages are English, French and Spanish. We’d like USA, France and España shown instead. Is this doable with the language switcher module?
If not, could you guide me on how I would go about developing a custom module for this?
To develop a custom module for HubSpot that displays region names instead of language names, and to handle multi-region and multi-language pages, you can follow these steps:
Difficulty level: Experienced Developer
1. Prepare CMS and Create Pages
First, create the necessary pages in HubSpot CMS for each language-region pair. Use the built-in multi-language features and apply a naming convention for regions.
2. Define Regions and Languages
Define your regions and languages, using ISO codes for slugs. For example:
USA (us)
France (fr)
Spain (es)
Languages: English (en), French (fr), Spanish (es)
3. Create Menus for Each Region-Language Pair
Create separate navigation menus for each language-region pair. These menus will be used in the language and region switcher module.
4. Implement Custom Language Region Switcher Module
Create a custom module for the language and region switcher.
Module Fields Configuration
In HubSpot, create a new module with fields to configure the regions and languages.
Module HTML & HubL
Next, create the HTML and HubL code to render the switcher based on the selected regions and languages.
5. Create Footer Module
Similarly, create a footer module that changes based on the selected language and region.
6. Test and Deploy
Test the modules and ensure they correctly switch regions and languages, and render the appropriate menus and content.