Language Selector
The Sonos language selector is a simple way for a user to pick their region and language preferences.
HTML
Because our system still relies heavily on server-side translation, we need quite a bit of HTML for this pattern to work. We hope to slim this down in the future by letting JavaScript do more of the heavy lifting for us.
<div class="row language-selector panel collapse white">
<div class="columns small-12">
<div data-select-language class="row">
<div class="columns small-12 large-centered">
<ul class="no-bullet row collapse">
<li data-languages="false" class="columns small-12 large-6">
<a href="?lang=en-us®ion=au">Australia</a>
</li>
<li data-languages="true" class="columns small-12 large-6">
<a>Belgium</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-3">
<li><a href="?lang=fr-fr®ion=be" class="button small">French</a></li>
<li><a href="?lang=nl-nl®ion=be" class="button small">Dutch</a></li>
<li><a href="?lang=en-us®ion=be" class="button small">English</a></li>
</ul>
</div>
</li>
</ul>
<ul class="no-bullet row collapse">
<li data-languages="true" class="columns small-12 large-6">
<a>Canada</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=fr-fr®ion=ca" class="button small">French</a></li>
<li><a href="?lang=en-us®ion=ca" class="button small">English</a></li>
</ul>
</div>
</li>
<li data-languages="true" class="columns small-12 large-6">
<a>China</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=zh-cn®ion=cn" class="button small">Chinese</a></li>
<li><a href="?lang=en-us®ion=cn" class="button small">English</a></li>
</ul>
</div>
</li>
</ul>
<ul class="no-bullet row collapse">
<li data-languages="true" class="columns small-12 large-6">
<a>Denmark</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=da-dk®ion=dk" class="button small">Danish</a></li>
<li><a href="?lang=en-us®ion=dk" class="button small">English</a></li>
</ul>
</div>
</li>
<li data-languages="true" class="columns small-12 large-6">
<a>France</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=fr-fr®ion=fr" class="button small">French</a></li>
<li><a href="?lang=en-us®ion=fr" class="button small">English</a></li>
</ul>
</div>
</li>
</ul>
<ul class="no-bullet row collapse">
<li data-languages="true" class="columns small-12 large-6">
<a>Germany</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=de-de®ion=de" class="button small">German</a></li>
<li><a href="?lang=en-us®ion=de" class="button small">English</a></li>
</ul>
</div>
</li>
<li data-languages="true" class="columns small-12 large-6">
<a>Italy</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=it-it®ion=it" class="button small">Italian</a></li>
<li><a href="?lang=en-us®ion=it" class="button small">English</a></li>
</ul>
</div>
</li>
</ul>
<ul class="no-bullet row collapse">
<li data-languages="true" class="columns small-12 large-6">
<a>Mexico</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=es-es®ion=mx" class="button small">Spanish</a></li>
<li><a href="?lang=en-us®ion=mx" class="button small">English</a></li>
</ul>
</div>
</li>
<li data-languages="true" class="columns small-12 large-6">
<a>Netherlands</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=nl-nl®ion=nl" class="button small">Dutch</a></li>
<li><a href="?lang=en-us®ion=nl" class="button small">English</a></li>
</ul>
</div>
</li>
</ul>
<ul class="no-bullet row collapse">
<li data-languages="true" class="columns small-12 large-6">
<a>Norway</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=no-no®ion=no" class="button small">Norwegian</a></li>
<li><a href="?lang=en-us®ion=no" class="button small">English</a></li>
</ul>
</div>
</li>
<li data-languages="true" class="columns small-12 large-6">
<a>Spain</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=es-es®ion=es" class="button small">Spanish</a></li>
<li><a href="?lang=en-us®ion=es" class="button small">English</a></li>
</ul>
</div>
</li>
</ul>
<ul class="no-bullet row collapse">
<li data-languages="true" class="columns small-12 large-6">
<a>Sweden</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=sv-se®ion=sv" class="button small">Swedish</a></li>
<li><a href="?lang=en-us®ion=sv" class="button small">English</a></li>
</ul>
</div>
</li>
<li data-languages="false" class="columns small-12 large-6">
<a href="?lang=en-us®ion=uk">United Kingdom</a>
</li>
</ul>
<ul class="no-bullet row collapse">
<li data-languages="true" class="columns small-12 large-6">
<a>United States</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-2">
<li><a href="?lang=en-us®ion=us" class="button small">English</a></li>
<li><a href="?lang=es-es®ion=us" class="button small">Spanish</a></li>
</ul>
</div>
</li>
<li data-languages="true" class="columns small-12 large-6 roe"><a>Rest of Europe</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-3">
<li><a href="?lang=da-dk®ion=roe" class="button small">Danish</a></li>
<li><a href="?lang=nl-nl®ion=roe" class="button small">Dutch</a></li>
<li><a href="?lang=en-us®ion=roe" class="button small">English</a></li>
</ul>
<ul class="button-group even-3">
<li><a href="?lang=fr-fr®ion=roe" class="button small">French</a></li>
<li><a href="?lang=de-de®ion=roe" class="button small">German</a></li>
<li><a href="?lang=it-it®ion=roe" class="button small">Italian</a></li>
</ul>
<ul class="button-group even-3">
<li><a href="?lang=no-no®ion=roe" class="button small">Norwegian</a></li>
<li><a href="?lang=es-es®ion=roe" class="button small">Spanish</a></li>
<li><a href="?lang=sv-se®ion=roe" class="button small">Swedish</a></li>
</ul>
</div>
</li>
</ul>
<ul class="no-bullet row collapse">
<li data-languages="true" class="columns small-12 large-6 roworld"><a>Rest of the World</a>
<div class="select-language hide">
<h5>Choose Your Language</h5>
<ul class="button-group even-3">
<li><a href="?lang=da-dk®ion=row" class="button small">Danish</a></li>
<li><a href="?lang=nl-nl®ion=row" class="button small">Dutch</a></li>
<li><a href="?lang=en-us®ion=row" class="button small">English</a></li>
</ul>
<ul class="button-group even-3">
<li><a href="?lang=fr-fr®ion=row" class="button small">French</a></li>
<li><a href="?lang=de-de®ion=row" class="button small">German</a></li>
<li><a href="?lang=it-it®ion=row" class="button small">Italian</a></li>
</ul>
<ul class="button-group even-3">
<li><a href="?lang=no-no®ion=row" class="button small">Norwegian</a></li>
<li><a href="?lang=es-es®ion=row" class="button small">Spanish</a></li>
<li><a href="?lang=sv-se®ion=row" class="button small">Swedish</a></li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
Language Selector + Reveal
One of most common ways we can use the language selector is with a modal window. The language selector also supports theming with the Sonos brand colors. The following examples will show what this can look like.
Choose Language(the language selector theme: white)
Choose Your Country
(the language selector theme: dark)
Choose Your Country
JavaScript Call
In order to initialize the language selector, we need to call a piece of JavaScript.
$('[data-select-language]').selectLanguage();