How to make dynamic pages multilingual

SOLVE
Highlighted
Occasional Contributor

Hi guys,

 

I'm trying to find out the best way to use multi language pages with HubDB and dynamic pages. Since I cannot set the Meta Title and Meta Description per language or through Hubl code, I'm wondering what solution would be best to solve this.

 

Situation:

I'm setting up a HubDB for some pages that I'd like to create. These pages are available in two languages (English and Dutch). Each row holds content for both languages.

I can only set one Meta Title field, but I would need two. Same goes for Meta Description.

 

I could 'solve this' in a couple of ways, but I'd like your advice on this.

 

Solution 1:

Use a language column in the HubDB and enter each 'page' twice, one in English and one in Dutch. Use the template to only load the items in the language that is used.

 

Pro: easy fix
Con: extra rows

 

Solution 2:

Use a separate HubDB per language and use a template for English and a separate template for Dutch.

Pro: also quite easy fix

Con: extra HubDB and extra Template

 

I searched the forum and help articles on this, but none of the info I found is about multi language dynamic pages.

 

I would really appreciate any help or some indication to understand which one of my 'solutions' would be smartest.

 

Thanks!

Bart

0 Upvotes
1 Accepted solution

Accepted Solutions
Highlighted
Solution
Occasional Contributor

Hi,

 

I went for Solution 2. Seemed the easiest to implement and maintain for my marketing colleagues. Also this allows for duplicate url paths. Putting in all in 1 HubDB would not allow me to use the same path twice. Since I'm running 2 languages, I would like some of the paths to be the same (except for the language parameter ofcourse).

 

Best,

Bart

View solution in original post

0 Upvotes
7 Replies 7
Community Manager

Hey @bartvintcent   

 

I apologize for the delay in getting back to you. I am wondering if you were able to resolve this or if you still need assistance on this matter?     

 

Thank you

Sharon


We are excited to announce that the Community will be launching a weekly newsletter on November 2, 2020!
Sign up today!
0 Upvotes
Highlighted
New Contributor | Platinum Partner

Hi @sharonlicari 

i would like to know the answer of this subject please because i am creating a dynamic multilingual page ,i have the problem of this regard on the url page details translate.

this is my page  and DBimg2.jpgsupport1.PNG

how can you  see the page detail

img3.jpg

but when i translate the page at the level route url is translate correctly

img4.jpg

but the   translate details page  url is not translate because the page path is unique

img5.jpg

how can  i do ?create a HubDB for each language ? what is the best solution?

Thanks in advance.

0 Upvotes
Highlighted
Solution
Occasional Contributor

Hi,

 

I went for Solution 2. Seemed the easiest to implement and maintain for my marketing colleagues. Also this allows for duplicate url paths. Putting in all in 1 HubDB would not allow me to use the same path twice. Since I'm running 2 languages, I would like some of the paths to be the same (except for the language parameter ofcourse).

 

Best,

Bart

View solution in original post

0 Upvotes
Highlighted
New Contributor | Platinum Partner

Hi @bartvintcent ,

I solved the problem by creating 1 hubDB for each language .then i connect each table table to its dynamic page.

thanks for your replay.

0 Upvotes
Highlighted
New Contributor | Platinum Partner

Hi @bartvintcent 

To risolve this problem i create a translate page of template   just for have a page in 2 language.now i can access to  the master page and using language dropdown menu for change the content setting.but my problem is the page path url is unique .how can Ido?

0 Upvotes
Highlighted
Occasional Contributor

Hi @sandrine1 ,

 

Sorry for the late reply, but here's some insight on how I got this to work with just 1 template and 2 HubDB tables.

 

So, I have 2 HubDB tables:

Feeds EN

Feeds NL

 

They both have the same table structure.

 

Then, I have one template, where I include a custom module. In that specific custom module, I check the language of the page by checking the 'content.language.languageTag' value. Based on the value, I select the right HubDB table.

 

{% if content.language.languageTag == 'nl' || taaltje == 'nl' %}
{% set table = hubdb_table_rows(xxxxx1,'orderBy=Name&draft=No') %}
{% else %}
{% set table = hubdb_table_rows(xxxxx2,'orderBy=Name&draft=No') %}
{% endif %}

 

This way, I can just use a single template for every language of the page and use a HubDB per page.

 

Then, in the template in the section that holds the markup for the detail page of the item in the HubDB, I include some wrapping HTML around the section to set the right HubDB table ID for the content page, so that my code gets its data from the right HubDB table:

 

{% if content.language.languageTag == 'nl' || taaltje == 'nl' %}
{% set dynamic_page_hubdb_table_id = xxxxx1%}
{% else %}
{% set dynamic_page_hubdb_table_id = xxxxx2%}
{% endif %}

{% if dynamic_page_hubdb_row %}
{{ html }}
{% endif %}

 

 

Pretty technical solution, but this works perfectly for us and requires no extra work for our marketeers.

 

Cheers,

Bart

 

0 Upvotes
Highlighted
New Contributor | Platinum Partner

I had done like this.

 

{% set dynamic_page_hubdb_table_id = xxxxx%}

{% if dynamic_page_hubdb_row %}
{# individual page content goes here#}

<div class="row clearfix padding20tb details p-3 " style="margin-top: -64px;">
<div class="span6 ">
<span ><img src="{{dynamic_page_hubdb_row.image.url }}" alt="{{ dynamic_page_hubdb_row.image.Name }}"></span>
</div>
<div class="span6 " >
{# If statements for sites using language code subdirectories #}

<h1 class="titolo-portfolio"> {{ dynamic_page_hubdb_row.name }}</h1>
<p class="sottotitolo-portfolio"> {{ dynamic_page_hubdb_row.title }}</p>
<p class="description"> {{ dynamic_page_hubdb_row.description }}</p>

<div >
</div>
<div id="demo" class="collapse form-usato p-4">
{% form
form_to_use="{{ module.form_field.form_id }}"
response_response_type="{{ module.form_field.response_type }}"
response_message="{{ module.form_field.message }}"
response_redirect_id="{{ module.form_field.redirect_id }}"
response_redirect_url="{{module.form_field.redirect_url}}"
gotowebinar_webinar_key="{{ module.form_field.gotowebinar_webinar_key }}"
%}
</div>
{% for category in row['category']%}
<h5 class="project_category">{{ dynamic_page_hubdb_row.category }}</h5>
{% endfor%}
</div>
<div class="content pt-3">
{{ dynamic_page_hubdb_row.content}}
</div>
<div class="span12 py-3" >
<img class="span4" src="{{ dynamic_page_hubdb_row.img.url}}" >
</div>
</div>
{% elif dynamic_page_hubdb_table_id %}
<!-- Shows all Products -->

{% set dynamic_page_hubdb_table_id = xxxx%}
{% set number = ['1','4','7','10','13','16'] %}
{% set queryparam = table|selectattr('categoryid','equalto','Gade') %}

<div class="container " >
<div class="row clearfix padding20tb py-3 ">
{% set allArticle = hubdb_table_rows(xxxx) %}
{% for row in hubdb_table_rows(dynamic_page_hubdb_table_id,queryparam) %}
{% if loop.index in number or loop.first %}
{% endif%}
<div class="col-lg-4 col-md-6 mb-4 image-hover mix {{ row.category.name }}">
<div class="box">
<span ><img class="image zoomIn " src="{{row.image.url }}" ></span>
<!-- <a class="link-view text-link " href="{{ request.path }}/{{ row.hs_path }}" target="_blank" >view </a> -->
<div class="overlay" >
<h5> <a class="link-view" href="{{ request.path }}/{{ row.hs_path }}" >view </a></h5>
</div>
</div>
<div class="portfolio_description py-3" >
<h5> <a class="entry-title text-center" href=" {{ request.path }}/{{ row.hs_path }}"> {{ row.name }} </a> </h5>
<h5 class="project_category py-3 ">{{ row.category.name }}</h5>
</div>
</div>
{% if loop.index is divisibleby 3 or loop.last %}
{% endif%}
{% endfor %}
</div>
</div>

{% endif %} <!-- endif dynamic_page_hubdb_row -->

 

thanks for your reply.

Cheers.

0 Upvotes