/* global React */
// LangSwitcher — native <select> of the 20 languages; switching reloads with the
// chosen locale (window.setLang). Used in the landing Nav and the Journal/Article SubNav.
(function () {
  var e = React.createElement;
  function LangSwitcher(props) {
    return e('span', { className: 'lang-wrap' },
      e('span', { className: 'lang-globe', 'aria-hidden': 'true' }, '🌐'),
      e('select', Object.assign({
        className: 'lang-select', 'aria-label': 'Language', value: window.LANG,
        onChange: function (ev) { window.setLang(ev.target.value); }
      }, props || {}),
        window.LANGS.map(function (l) { return e('option', { key: l.c, value: l.c }, l.n); })));
  }
  window.LangSwitcher = LangSwitcher;
})();
