Streaming live at 10am (PST)

Ability to set Lang Tag for individual site pages


#1

Hi Webflow

Is there a way to set HTML LANG in Page-Setting rather than specify (globally) in Site-Setting?

I had tried use this script, it works in the code but it not trigger my Snipcart Locale Feature.

<script>
 $(document).ready(function() {
  $('html').attr('lang','en');
 });
</script>`

I suspect that this might be something to do with the header that being sent (lang='en') when onLoad. And later on this javascript doing it's job by modified the tag within this loaded document (change into lang='th') which is too late.

Any suggestion would be appreciated.
KMB


#2

Additional Info.

I have tested my hypothesis and it is true.

I exported my webflow site and then upload to another server.
Before i upload it, i had modify just HTML TAG in to LANG='TH'.
The snipcart beautifully change it's locale into my local language.

If webflow could let me set my own HTML LANG Tag in each particular page, it would be wonderful since i have to host on webflow.


#3

Hey Guys

I have resolved my issue. This method works wonderfully.

All you have to do is.
1> Add Snipcart's essential code to your SITE SETTING > Custom Code > Head

2> Then add this code to each specific page, goto your Page Setting > Header, in order to trigger Snipcart to dynamically change it's shopping cart language into your desired language.

 <script type="text/javascript">
  $("html").attr("lang","en");
  </script>

Don't forget to change the"en" (English) into your desired language.
For example:
$("html").attr("lang","fr"); is for french.
$("html").attr("lang","es"); is for Spanish.
find your Language Code Here: http://www.science.co.il/Language/Locale-codes.asp

Any suggestion is welcome.

Cheers!


#4

Hi @KMB, this is very interesting, thanks for sharing! I am going to check this out further :wink:

In the meantime, I have turned this into a Wish List item for our UI. It would be nice to be able to set the Lang tag, page by page.

Cheers!


#5

This topic was automatically closed after 60 days. New replies are no longer allowed.