Shopify / liquid

Liquid markup language. Safe, customer facing template language for flexible web apps.
https://shopify.github.io/liquid/
MIT License
11.11k stars 1.39k forks source link

Dynamic change locale (i18n) setting #865

Open Asoul opened 7 years ago

Asoul commented 7 years ago

Hi there,

I'm new to Shopify, after building the basic website, I'd like to add i18n to the site.

There is already an locales folder in the repositories, and we can set the language for the theme in admin panel, that means the language is configurable.

Is there any way to make user change their language? ex. call a javascript function or add parameter is url

I've read #791, and seems the t filter is built by shopify

I found lots of plugins can do multi-lang, but they all need cost per month. If there is some API for developer to change the language, I think it's not difficult to build a multi-lang sites.

Thanks

P.S. this question have already post to Shopify forum

Asoul commented 7 years ago

I have used a client-side generated solution:

Sample code: https://gist.github.com/Asoul/e5ee0a0f0ed17c93383ff47818b319c4