Switch language between pages

174 views
Skip to first unread message

Giacomo Lamonaco

unread,
May 4, 2016, 7:58:17 AM5/4/16
to Hippo Community
Hi all,

I wrote a similar message some hours ago, but I'm not sure if I really sent it.

I've started to experiment multi-language site functionality in Hippo. I am able to get the translated versions (and the related link) starting from an hippo document.
Now I'm trying to switch language between two pages (containing a result sets). Suppose I have two different sitemaps, one foreach languange (English/Italian):

->mysite_en
 
->hts:sitemap
     
->food
         
[hst:componentconfigurationid = hst:pages/pasta-list]
->mysite_it
 
->hts:sitemap
     
->mangiare
         
[hst:componentconfigurationid = hst:pages/pasta-list]


Currently I am able to reach mangiare using this url http://localhost/site/mangiare, and food using http://localhost/site/en/food

My question: when I navigate this URL http://localhost/site/mangiare, is it possible to display in the same page the related english url (http://localhost/site/en/food) ? Do I need to define some relations between the two sitemap items?

Thanks,
Giacomo

Jasper Floor

unread,
May 4, 2016, 8:06:38 AM5/4/16
to Hippo Community
HI,

You can get all available translations of a document [1] and then create a link with the hst:link tag.


mvg,
Jasper

--
Hippo Community Group: The place for all discussions and announcements about Hippo CMS (and HST, repository etc. etc.)
 
To post to this group, send email to hippo-c...@googlegroups.com
RSS: https://groups.google.com/group/hippo-community/feed/rss_v2_0_msgs.xml?num=50
---
You received this message because you are subscribed to the Google Groups "Hippo Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hippo-communi...@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.

Giacomo Lamonaco

unread,
May 4, 2016, 8:51:27 AM5/4/16
to Hippo Community
Thanks for your reply.

Currently in my project there could exist pages that don't have references to documents or folders: in that case pages contain a resultset (related to a faceted navigation). I tried to assign a refId ('foodId') to each sitemap item (for each language), but I cannot get the reference between those items.

<@hst.link siteMapItemRefId="foodId" />

How can I generate link in my language switcher for each supported languange?

Giacomo

Woonsan Ko

unread,
May 4, 2016, 9:19:45 AM5/4/16
to hippo-c...@googlegroups.com
On Wed, May 4, 2016 at 8:51 AM, Giacomo Lamonaco <giac...@gmail.com> wrote:
Thanks for your reply.

Currently in my project there could exist pages that don't have references to documents or folders: in that case pages contain a resultset (related to a faceted navigation). I tried to assign a refId ('foodId') to each sitemap item (for each language), but I cannot get the reference between those items.
The easiest way should still be to set a relative content path on each sitemap item. The translated documents can be just empty place holders, only for your landing pages.
Then you can easily create links by looking up a translated document by locale and pass the document bean to hst.link tags.
 

<@hst.link siteMapItemRefId="foodId" />

How can I generate link in my language switcher for each supported languange?
If you want to create links without a request context content bean (from relative content path on sitemap item), then I guess you can set sitemapitem ref ids to the same value (e.g, "foodId") in each localized sitemap configuration, and you can pass mount alias string additionally.

For example,
<@hst.link siteMapItemRefId="foodId" mount="site" />
or
<@hst.link siteMapItemRefId="foodId" mount="site_en" />

You need to set @hst:alias properties on hst:root mount node and hst:root/en mount node accordingly.

Regards,

Woonsan



--
w....@onehippo.com     www.onehippo.com
Boston - 745 Atlantic Ave, 8th Floor, Boston MA 02111
Amsterdam - Oosteinde 11, 1017 WT Amsterdam
US +1 877 414 4776 (toll free)
Europe +31(0)20 522 4466

Giacomo Lamonaco

unread,
May 4, 2016, 10:24:02 AM5/4/16
to Hippo Community
Thanks Woonsan, I specified the mount parameters in hst.link and links are correctly generated.

As you can image, I'm implementing a faceted navigation that allows me to have the documents in different folders. Currently I'm not able to switch language from a document item in a faceted result set

This is the sitemaps structure:

EN
-->food [hst:sitemapitem] { hst:componentconfigurationid=hst:pages/pasta-list, hst:relativecontentpath=pastafolder/facet-pasta, hst:refId=foodId }
_default_.html [hst:sitemapitem] { hst:componentconfigurationid:hst:pages/pasta-page, hst:relativecontentpath=pastafolder/facet-pasta/hippo:resultset/${1}.html  }
IT
-->mangiare
 
[hst:sitemapitem] { hst:componentconfigurationid=hst:pages/pasta-list, hst:relativecontentpath=pastafolder/facet-pasta, hst:refId=foodId }
_default_.html [hst:sitemapitem] { hst:componentconfigurationid:hst:pages/pasta-page, hst:relativecontentpath=pastafolder/facet-pasta/hippo:resultset/${1}.html  }

How can I generate link in my language switcher in this case?

Thanks,
Giacomo
Reply all
Reply to author
Forward
0 new messages