<commit_before>import React, { FunctionComponent } from 'react';
import { useDispatch } from 'react-redux';

import { setLanguage } from 'js/store/appState/actions';

interface DropProps {
  language: string;
  alternativeLanguage: string;
  selectedLanguage: string;
}

function valueToLang(abbrev: string): string {
  let lang = '';

  switch (abbrev) {
    case 'en':
      lang = 'English';
      break;
    case 'es':
      lang = 'Spanish';
      break;
    case 'fr':
      lang = 'French';
      break;
    case 'pt':
      lang = 'Portuguese';
      break;
    case 'id':
      lang = 'Indonesian';
      break;
    case 'ka':
      lang = 'Georgian';
      break;
    case 'zh':
      lang = 'Chinese';
      break;
    default:
      break;
  }

  return lang;
}

const LanguageDropdown = (props: DropProps) => {
  const dispatch = useDispatch();

  return (
    <div className="language-dropdown-container">
      <select
        value={props.selectedLanguage}
        onChange={e => dispatch(setLanguage(e.target.value))}
      >
        <option value={props.language}>
          {valueToLang(props.selectedLanguage)}
        </option>
        <option value={props.alternativeLanguage}>
          {valueToLang(props.alternativeLanguage)}
        </option>
      </select>
    </div>
  );
};<commit_msg>Hoisting a new map dispatch to the controller<commit_after>import React, { FunctionComponent } from 'react';
import { mapController } from 'js/controllers/mapController';

interface DropProps {
  language: string;
  alternativeLanguage: string;
  selectedLanguage: string;
}

function valueToLang(abbrev: string): string {
  let lang = '';

  switch (abbrev) {
    case 'en':
      lang = 'English';
      break;
    case 'es':
      lang = 'Spanish';
      break;
    case 'fr':
      lang = 'French';
      break;
    case 'pt':
      lang = 'Portuguese';
      break;
    case 'id':
      lang = 'Indonesian';
      break;
    case 'ka':
      lang = 'Georgian';
      break;
    case 'zh':
      lang = 'Chinese';
      break;
    default:
      break;
  }

  return lang;
}

const LanguageDropdown = (props: DropProps) => {
  return (
    <div className="language-dropdown-container">
      <select
        value={props.selectedLanguage}
        onChange={e => mapController.changeLanguage(e.target.value)}
      >
        <option value={props.language}>
          {valueToLang(props.selectedLanguage)}
        </option>
        <option value={props.alternativeLanguage}>
          {valueToLang(props.alternativeLanguage)}
        </option>
      </select>
    </div>
  );
};
{'fraction_non_alphanumeric': 0.1325626204238921, 'fraction_numerical': 0.0, 'mean_word_length': 2.43841059602649, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '816228', 'n_tokens_mistral': 790, 'n_tokens_neox': 771, 'n_words': 184}