<commit_before>import React from 'react';
import { connect } from 'react-redux';
import Helmet from 'react-helmet';
import { player } from 'reducers';
import {
  getPlayer,
  getPlayerWinLoss,
} from 'actions';
import TabBar from 'components/TabBar';
import Spinner from 'components/Spinner';
import PlayerHeader from './Header/PlayerHeader';
// import Error from '../Error';
import styles from './Player.css';
import playerPages from './playerPages';

const getData = (props) => {
  props.getPlayer(props.playerId);
  props.getPlayerWinLoss(props.playerId, props.location.query);
};

class RequestLayer extends React.Component {
  componentDidMount() {
    getData(this.props);
  }

  componentWillUpdate(nextProps) {
    if (this.props.playerId !== nextProps.playerId || this.props.location.key !== nextProps.location.key) {
      getData(nextProps);
    }
  }

  render() {
    const { playerId, location, routeParams } = this.props;
    const info = routeParams.info || 'overview';
    const page = playerPages(playerId).find(page => page.key === info);
    const playerName = this.props.officialPlayerName || this.props.playerName || 'Anonymous';
    const title = page ? `${playerName} - ${page.name}` : playerName;
    return (
      <div>
        <Helmet title={title} />
        <div>
          <PlayerHeader playerId={playerId} location={location} />
          <TabBar info={info} tabs={playerPages(playerId)} />
        </div>
        <div className={styles.page}>
          {page ? page.content(playerId, routeParams, location) : <Spinner />}
        </div>
      </div>
    );
  }
}

const mapStateToProps = (state, ownProps) => ({
  // Passed from react-router
  playerId: ownProps.params.playerId,
  playerName: player.getPlayerName(state, ownProps.params.playerId),
  officialPlayerName: player.getOfficialPlayerName(state, ownProps.params.playerId),
});
<commit_msg>Localize anonymous player<commit_after>import React from 'react';
import { connect } from 'react-redux';
import Helmet from 'react-helmet';
import { player } from 'reducers';
import {
  getPlayer,
  getPlayerWinLoss,
} from 'actions';
import TabBar from 'components/TabBar';
import Spinner from 'components/Spinner';
import PlayerHeader from './Header/PlayerHeader';
// import Error from '../Error';
import styles from './Player.css';
import playerPages from './playerPages';
import strings from 'lang';

const getData = (props) => {
  props.getPlayer(props.playerId);
  props.getPlayerWinLoss(props.playerId, props.location.query);
};

class RequestLayer extends React.Component {
  componentDidMount() {
    getData(this.props);
  }

  componentWillUpdate(nextProps) {
    if (this.props.playerId !== nextProps.playerId || this.props.location.key !== nextProps.location.key) {
      getData(nextProps);
    }
  }

  render() {
    const { playerId, location, routeParams } = this.props;
    const info = routeParams.info || 'overview';
    const page = playerPages(playerId).find(page => page.key === info);
    const playerName = this.props.officialPlayerName || this.props.playerName || strings.general_anonymous;
    const title = page ? `${playerName} - ${page.name}` : playerName;
    return (
      <div>
        <Helmet title={title} />
        <div>
          <PlayerHeader playerId={playerId} location={location} />
          <TabBar info={info} tabs={playerPages(playerId)} />
        </div>
        <div className={styles.page}>
          {page ? page.content(playerId, routeParams, location) : <Spinner />}
        </div>
      </div>
    );
  }
}

const mapStateToProps = (state, ownProps) => ({
  // Passed from react-router
  playerId: ownProps.params.playerId,
  playerName: player.getPlayerName(state, ownProps.params.playerId),
  officialPlayerName: player.getOfficialPlayerName(state, ownProps.params.playerId),
});

{'fraction_non_alphanumeric': 0.1424083769633508, 'fraction_numerical': 0.0, 'mean_word_length': 3.705665024630542, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 29, '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': '1986397', 'n_tokens_mistral': 1150, 'n_tokens_neox': 1134, 'n_words': 258}