How do I get current site locale in JSP

42 views
Skip to first unread message

Nic

unread,
Jun 27, 2018, 7:38:43 PM6/27/18
to Hippo Community
Hello,

I have a site that has a translation in Italian. Everything is working wonderfully but I need to know what is the current locale the website is displaying because I need it to build some url.

For exampe on the Italian version a link could be <a href="www.agenzia-alfa-aws-event.com">vieni a trovarci qui</a>

while in En could be 

For exampe on the Italian version a link could be <a href="www.alfa-agency-aws-event/uk/sqaure.co.uk">we are herei</a>

I have looked on the official documentation and also around the internet but i could not find the solution.

My web site translations have been done following the documentation and i have the English version at http://domani.co.uk and the Italian version at http://domain.co.uk/it

Thanks in advance for your kind help.

Best Regards

Nic

Woonsan Ko

unread,
Jun 27, 2018, 8:15:14 PM6/27/18
to hippo-c...@googlegroups.com
On Wed, Jun 27, 2018 at 7:38 PM, Nic <nicola...@gmail.com> wrote:
Hello,

I have a site that has a translation in Italian. Everything is working wonderfully but I need to know what is the current locale the website is displaying because I need it to build some url.
Use HstRequest.getLocale() or HstRequestContext.getPreferredLocale() in HstComponent code.
Or use hstRequest.locale.* (e.g, <#if hstRequest.locale.language == "en">) or hstRequestContext.preferredLocale.* in templates.

Regards,

Woonsan
 

For exampe on the Italian version a link could be <a href="www.agenzia-alfa-aws-event.com">vieni a trovarci qui</a>

while in En could be 

For exampe on the Italian version a link could be <a href="www.alfa-agency-aws-event/uk/sqaure.co.uk">we are herei</a>

I have looked on the official documentation and also around the internet but i could not find the solution.

My web site translations have been done following the documentation and i have the English version at http://domani.co.uk and the Italian version at http://domain.co.uk/it

Thanks in advance for your kind help.

Best Regards

Nic

--
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-community@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-community+unsubscribe@googlegroups.com.
Visit this group at https://groups.google.com/group/hippo-community.
For more options, visit https://groups.google.com/d/optout.



--

Nic

unread,
Jun 28, 2018, 1:31:29 AM6/28/18
to Hippo Community
Thank you Woonsan,

It works great!!!

Thanks


Il giorno giovedì 28 giugno 2018 01:15:14 UTC+1, woonsan.ko ha scritto:
On Wed, Jun 27, 2018 at 7:38 PM, Nic <nicola...@gmail.com> wrote:
Hello,

I have a site that has a translation in Italian. Everything is working wonderfully but I need to know what is the current locale the website is displaying because I need it to build some url.
Use HstRequest.getLocale() or HstRequestContext.getPreferredLocale() in HstComponent code.
Or use hstRequest.locale.* (e.g, <#if hstRequest.locale.language == "en">) or hstRequestContext.preferredLocale.* in templates.

Regards,

Woonsan
 

For exampe on the Italian version a link could be <a href="www.agenzia-alfa-aws-event.com">vieni a trovarci qui</a>

while in En could be 

For exampe on the Italian version a link could be <a href="www.alfa-agency-aws-event/uk/sqaure.co.uk">we are herei</a>

I have looked on the official documentation and also around the internet but i could not find the solution.

My web site translations have been done following the documentation and i have the English version at http://domani.co.uk and the Italian version at http://domain.co.uk/it

Thanks in advance for your kind help.

Best Regards

Nic

--
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.
Reply all
Reply to author
Forward
0 new messages