<commit_before>import React, { Component, PropTypes } from 'react';
import { FormattedMessage } from 'react-intl';
import Relay from 'react-relay';
import Select from 'react-select';
import AboutRoute from '../../relay/AboutRoute';

class LangSelect extends Component {
  constructor(props) {
    super(props);

    this.state = {
      selected: null,
    };
  }

  handleChange(value) {
    this.setState({selected: value});
    this.props.onChange(value);
  }

  isDisabled(code) {
    return (this.props.usedLanguages.findIndex(value => code === value) > -1);
  }

  render() {
    const about = this.props.about;
    const languages = JSON.parse(about.languages_supported);
    const show_languages = this.props.showLanguages ? JSON.parse(this.props.showLanguages) : null;

    let options = [];

    Object.keys(languages).map((key, index) => {
      if (!show_languages || (show_languages.findIndex(value => key === value) > -1)) {
        options.push({ value: key, label: languages[key], disabled:this.isDisabled(key) });
      }
    });

    return (
      <Select
        name="translation_language"
        value={this.state.selected}
        className="dropdown"
        id="select"<commit_msg>Cleanup #5839<commit_after>import React, { Component, PropTypes } from 'react';
import { FormattedMessage } from 'react-intl';
import Relay from 'react-relay';
import Select from 'react-select';
import AboutRoute from '../../relay/AboutRoute';

class LangSelect extends Component {
  constructor(props) {
    super(props);

    this.state = {
      selected: null,
    };
  }

  handleChange(value) {
    this.setState({selected: value});
    this.props.onChange(value);
  }

  isDisabled(code) {
    return (this.props.usedLanguages.findIndex(value => code === value) > -1);
  }

  render() {
    const about = this.props.about;
    const languages = JSON.parse(about.languages_supported);
    const show_languages = this.props.showLanguages ? JSON.parse(this.props.showLanguages) : null;

    let options = [];
    Object.keys(languages).forEach((key, index) => {
      if (!show_languages || (show_languages.findIndex(value => key === value) > -1)) {
        options.push({ value: key, label: languages[key], disabled: this.isDisabled(key) });
      }
    });

    return (
      <Select
        value={this.state.selected}
{'fraction_non_alphanumeric': 0.1483069009858551, 'fraction_numerical': 0.0034290612944706386, 'mean_word_length': 3.3142329020332717, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 13, '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': '4143240', 'n_tokens_mistral': 718, 'n_tokens_neox': 708, 'n_words': 148}