Ability to set Lang Tag for individual site pages

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

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.

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: Language Codes

Any suggestion is welcome.

Cheers!

1 Like

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!

3 Likes

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