demos/src/LocaleSelector.js
function getLocaleOptions() {
  if (!localeOptions) {
    localeOptions = Object.keys(locales).map(locale => {
      const option = document.createElement('option');
      option.value = locale;
      option.disabled = !localeSupported(locale);
      option.textContent = locales[locale];
      return option;
    });
    Object.freeze(localeOptions);
  }
  return localeOptions;
}
function getLocaleOptions() {
  if (!localeOptions) {
    localeOptions = Object.keys(locales).map(locale => {
      const option = document.createElement('option');
      option.value = locale;
      option.disabled = !localeSupported(locale);
      option.textContent = locales[locale];
      return option;
    });
    Object.freeze(localeOptions);
  }
  return localeOptions;
}
function getLocaleOptions ( ) { if ( ! localeOptions ) { localeOptions = Object . keys ( locales ) . map ( locale => { const option = document . createElement ( 'option' ) ; option . value = locale ; option . disabled = ! localeSupported ( locale ) ; option . textContent = locales [ locale ] ; return option ; } ) ; Object . freeze ( localeOptions ) ; } return localeOptions ; }
Create options for all locales and cache the result.
Create options for all locales and cache the result .