<commit_before>var classNames = require('classnames');
var React = require('react');

var jar  = require('../../lib/jar.js');
var languages = require('../../../languages.json');
var Form = require('../forms/form.jsx');
var Select = require('../forms/select.jsx');

/**
 * Footer dropdown menu that allows one to change their language.
 */
var LanguageChooser = React.createClass({
    type: 'LanguageChooser',
    getDefaultProps: function () {
        return {
            languages: languages,
            locale: window._locale
        };
    },
    onSetLanguage: function (name, value) {
        jar.set('scratchlanguage', value);
        window.location.reload();
    },
    render: function () {
        var classes = classNames(
            'language-chooser',
            this.props.className
        );
        var languageOptions = Object.keys(this.props.languages).map(function (value) {
            return {value: value, label: this.props.languages[value]};
        }.bind(this));
        return (
            <Form className={classes}>
                <Select name="language"
                        options={languageOptions}
                        defaultValue={this.props.locale}
                        onChange={this.onSetLanguage} />
            </Form>
        );
    }
});<commit_msg>Update language chooser for formsy<commit_after>var classNames = require('classnames');
var React = require('react');

var jar  = require('../../lib/jar.js');
var languages = require('../../../languages.json');
var Form = require('../forms/form.jsx');
var Select = require('../forms/select.jsx');

/**
 * Footer dropdown menu that allows one to change their language.
 */
var LanguageChooser = React.createClass({
    type: 'LanguageChooser',
    getDefaultProps: function () {
        return {
            languages: languages,
            locale: window._locale
        };
    },
    onSetLanguage: function (name, value) {
        jar.set('scratchlanguage', value);
        window.location.reload();
    },
    render: function () {
        var classes = classNames(
            'language-chooser',
            this.props.className
        );
        var languageOptions = Object.keys(this.props.languages).map(function (value) {
            return {value: value, label: this.props.languages[value]};
        }.bind(this));
        return (
            <Form className={classes}>
                <Select name="language"
                        options={languageOptions}
                        defaultValue={this.props.locale}
                        onChange={this.onSetLanguage}
                        required />
            </Form>
        );
    }
});
{'fraction_non_alphanumeric': 0.14103525881470366, 'fraction_numerical': 0.0, 'mean_word_length': 1.9567627494456763, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, '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': '524019', 'n_tokens_mistral': 695, 'n_tokens_neox': 681, 'n_words': 151}