How to use the i18n-js.toNumber function in i18n-js

To help you get started, we’ve selected a few i18n-js examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Sage / carbon / src / __experimental__ / components / textarea / textarea.component.js View on Github external
get characterCount() {
    const value = this.props.value || '';
    const { characterLimit, warnOverLimit } = this.props;

    if (!characterLimit) { return null; }

    return (
      
    );
  }
github Sage / carbon / src / __deprecated__ / components / textarea / textarea.js View on Github external
get characterCount() {
    const value = this.props.value || '';

    if (!this.props.characterLimit) { return null; }
    return (
      <div data-element="character-limit">
        { I18n.t('textarea.limit.prefix', { defaultValue: 'You have used ' }) }
        <span>
          { I18n.toNumber(value.length, this.i18nNumberOpts) }
        </span>
        { I18n.t('textarea.limit.middle', { defaultValue: ' of ' }) }
        <span>
          { I18n.toNumber(this.props.characterLimit, this.i18nNumberOpts) }
        </span>
        { I18n.t('textarea.limit.suffix', { defaultValue: ' characters' }) }
      </div>
    );
  }
github Sage / carbon / src / __experimental__ / components / textarea / textarea.component.js View on Github external
get characterCount() {
    const value = this.props.value || '';
    const { characterLimit, warnOverLimit } = this.props;

    if (!characterLimit) { return null; }

    return (
      
    );
  }
github Sage / carbon / src / __deprecated__ / components / textarea / textarea.js View on Github external
get characterCount() {
    const value = this.props.value || '';

    if (!this.props.characterLimit) { return null; }
    return (
      <div data-element="character-limit">
        { I18n.t('textarea.limit.prefix', { defaultValue: 'You have used ' }) }
        <span>
          { I18n.toNumber(value.length, this.i18nNumberOpts) }
        </span>
        { I18n.t('textarea.limit.middle', { defaultValue: ' of ' }) }
        <span>
          { I18n.toNumber(this.props.characterLimit, this.i18nNumberOpts) }
        </span>
        { I18n.t('textarea.limit.suffix', { defaultValue: ' characters' }) }
      </div>
    );
  }