Created
April 27, 2020 11:00
-
-
Save tomblanchard/e96535fc8390012a01995d494d8e73c3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var element = document.querySelector('[data-module-language-selector]'); | |
if (element) { | |
element.addEventListener('change', (event) => { | |
window.location = event.target.value; | |
}); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<select data-module-language-selector> | |
{% for locale in shop.published_locales %} | |
{% assign locale_active = false %} | |
{% if locale.iso_code == request.locale.iso_code %} | |
{% assign locale_active = true %} | |
{% endif %} | |
<option value="{{ locale.root_url }}" {% if locale_active %}selected{% endif %}> | |
{{ locale.name }} | |
</option> | |
{% endfor %} | |
</select> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment