react-i18nify
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -7,6 +7,10 @@ 'use strict'; | ||
var _momentWithLocalesMin = require('moment/min/moment-with-locales.min.js'); | ||
var _moment = require('moment'); | ||
var _momentWithLocalesMin2 = _interopRequireDefault(_momentWithLocalesMin); | ||
var _moment2 = _interopRequireDefault(_moment); | ||
var _locales = require('moment/min/locales'); | ||
var _locales2 = _interopRequireDefault(_locales); | ||
var _intl = require('intl'); | ||
@@ -26,2 +30,5 @@ | ||
setTranslations: function setTranslations(translations) { | ||
this.loadTranslations(translations); | ||
}, | ||
loadTranslations: function loadTranslations(translations) { | ||
this._translations = translations; | ||
@@ -34,2 +41,5 @@ }, | ||
}, | ||
l: function l(value, options) { | ||
return this._localize(value, options); | ||
}, | ||
_translate: function _translate(key) { | ||
@@ -50,9 +60,5 @@ var replacements = arguments.length <= 1 || arguments[1] === undefined ? {} : arguments[1]; | ||
}, | ||
l: function l(value, options) { | ||
return this._localize(value, options); | ||
}, | ||
_localize: function _localize(value, options) { | ||
if ('dateFormat' in options) { | ||
_momentWithLocalesMin2.default.locale(this._locale); | ||
return (0, _momentWithLocalesMin2.default)(value).format(this.t(options.dateFormat)); | ||
return (0, _moment2.default)(value).format(this.t(options.dateFormat)); | ||
} | ||
@@ -59,0 +65,0 @@ if (typeof value === 'number') { |
{ | ||
"name": "react-i18nify", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Simple i18n translation and localization components and helpers for React.", | ||
@@ -5,0 +5,0 @@ "main": "./build/index.js", |
@@ -17,3 +17,3 @@ # react-i18nify | ||
I18n.setTranslations({ | ||
I18n.loadTranslations({ | ||
en: { | ||
@@ -20,0 +20,0 @@ application: { |
@@ -1,2 +0,3 @@ | ||
import moment from 'moment/min/moment-with-locales.min.js'; | ||
import moment from 'moment'; | ||
import locales from 'moment/min/locales'; | ||
import IntlPolyfill from 'intl'; | ||
@@ -13,2 +14,6 @@ | ||
setTranslations(translations) { | ||
this.loadTranslations(translations); | ||
}, | ||
loadTranslations(translations) { | ||
this._translations = translations; | ||
@@ -21,2 +26,6 @@ }, | ||
l(value, options) { | ||
return this._localize(value, options); | ||
}, | ||
_translate(key, replacements = {}) { | ||
@@ -36,9 +45,4 @@ let translation = ''; | ||
l(value, options) { | ||
return this._localize(value, options); | ||
}, | ||
_localize(value, options) { | ||
if ('dateFormat' in options) { | ||
moment.locale(this._locale); | ||
return moment(value).format(this.t(options.dateFormat)); | ||
@@ -45,0 +49,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
16902
291