<commit_before>/**
 * preact plugin that provides an I18n helper using a Higher Order Component.
 */

'use strict'

import React, { Component } from 'react'

// Provider root component
export class I18nProvider extends Component {
  getChildContext () {
    return { t: this.props.i18n.t.bind(this.props.i18n) }
  }

  render () {
    return this.props.children && this.props.children[0] || null
  }
}

I18nProvider.childContextTypes = {
  t: React.PropTypes.func
}

// higher order decorator for components that need `t`
export const translate = () => {
  return (WrappedComponent) => {
    const _translate = (props, context) => (
      <WrappedComponent {...props} t={context.t} />
    )
    return _translate
  }
}<commit_msg>[feat] Adds support for formatting i18n function<commit_after>/**
 * preact plugin that provides an I18n helper using a Higher Order Component.
 */

'use strict'

import React, { Component } from 'react'

// Provider root component
export class I18nProvider extends Component {
  getChildContext () {
    return {
      t: this.props.i18n.t.bind(this.props.i18n),
      f: this.props.i18nDate.bind(this.props.i18nDate)
    }
  }

  render () {
    return this.props.children && this.props.children[0] || null
  }
}

I18nProvider.childContextTypes = {
  t: React.PropTypes.func,
  f: React.PropTypes.func
}

// higher order decorator for components that need `t` and/or `f`
export const translate = () => {
  return (WrappedComponent) => {
    const _translate = (props, context) => (
      <WrappedComponent {...props} t={context.t} f={context.f} />
    )
    return _translate
  }
}
{'fraction_non_alphanumeric': 0.13019218846869188, 'fraction_numerical': 0.01735895846249225, 'mean_word_length': 3.2811671087533156, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 11, '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': '2094374', 'n_tokens_mistral': 539, 'n_tokens_neox': 516, 'n_words': 137}