UNPKG

react-i18nify

Version:

Simple i18n translation and localization components and helpers for React.

27 lines (22 loc) 616 B
import PropTypes from 'prop-types'; import { localize } from './core'; import BaseComponent from './Base'; class Localize extends BaseComponent { render() { const { value, dateFormat, parseFormat, options = {}, } = this.props; const localization = localize(value, { ...options, dateFormat, parseFormat }); return localization; } } Localize.propTypes = { value: PropTypes.oneOfType([ PropTypes.string, PropTypes.number, PropTypes.object]).isRequired, dateFormat: PropTypes.string, parseFormat: PropTypes.string, options: PropTypes.object, }; export default Localize;