Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-i18nify

Package Overview
Dependencies
Maintainers
1
Versions
131
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-i18nify - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

20

build/lib/I18n.js

@@ -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 @@ }

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc