@shopify/react-i18n
Advanced tools
Comparing version 7.6.0 to 7.6.1
@@ -1,1 +0,1 @@ | ||
module.exports = require("./build/cjs/babel-plugin/index.js"); | ||
module.exports = require("./build/cjs/babel-plugin/index.js"); |
@@ -5,5 +5,4 @@ 'use strict'; | ||
var _rollupPluginBabelHelpers = require('./_virtual/_rollupPluginBabelHelpers.js'); | ||
var dates = require('@shopify/dates'); | ||
var decorators = require('@shopify/decorators'); | ||
var functionEnhancers = require('@shopify/function-enhancers'); | ||
var i18n = require('@shopify/i18n'); | ||
@@ -18,3 +17,2 @@ var types = require('./types.js'); | ||
var _dec, _class; | ||
// Used for currencies that don't use fractional units (eg. JPY) | ||
@@ -27,3 +25,3 @@ const PERIOD = '.'; | ||
const NEGATIVE_CHARACTERS = '\\p{Pd}\u2212'; | ||
let I18n = (_dec = decorators.memoize(), (_class = class I18n { | ||
class I18n { | ||
get language() { | ||
@@ -87,2 +85,21 @@ return i18n.languageFromLocale(this.locale); | ||
this.numberSymbols = functionEnhancers.memoize(() => { | ||
const formattedNumber = this.formatNumber(123456.7, { | ||
maximumFractionDigits: 1, | ||
minimumFractionDigits: 1 | ||
}); | ||
let thousandSymbol; | ||
let decimalSymbol; | ||
for (const char of formattedNumber) { | ||
if (isNaN(parseInt(char, 10))) { | ||
if (thousandSymbol) decimalSymbol = char;else thousandSymbol = char; | ||
} | ||
} | ||
return { | ||
thousandSymbol, | ||
decimalSymbol | ||
}; | ||
}); | ||
this.locale = _locale; | ||
@@ -326,24 +343,5 @@ this.defaultCountry = country; | ||
return Boolean(easternNameOrderFormatter); | ||
} | ||
} // eslint-disable-next-line @typescript-eslint/member-ordering | ||
numberSymbols() { | ||
const formattedNumber = this.formatNumber(123456.7, { | ||
maximumFractionDigits: 1, | ||
minimumFractionDigits: 1 | ||
}); | ||
let thousandSymbol; | ||
let decimalSymbol; | ||
for (const char of formattedNumber) { | ||
if (isNaN(parseInt(char, 10))) { | ||
if (thousandSymbol) decimalSymbol = char;else thousandSymbol = char; | ||
} | ||
} | ||
return { | ||
thousandSymbol, | ||
decimalSymbol | ||
}; | ||
} | ||
formatCurrencyAuto(amount, options = {}) { | ||
@@ -675,4 +673,4 @@ // use the short format if we can't determine a currency match, or if the | ||
}, (_rollupPluginBabelHelpers.applyDecoratedDescriptor(_class.prototype, "numberSymbols", [_dec], Object.getOwnPropertyDescriptor(_class.prototype, "numberSymbols"), _class.prototype)), _class)); | ||
} | ||
exports.I18n = I18n; |
@@ -68,3 +68,3 @@ /// <reference types="react" /> | ||
hasEasternNameOrderFormatter(): boolean; | ||
numberSymbols(): { | ||
numberSymbols: () => { | ||
thousandSymbol: any; | ||
@@ -71,0 +71,0 @@ decimalSymbol: any; |
@@ -1,1 +0,1 @@ | ||
module.exports = require("./build/cjs/babel-plugin/generate-dictionaries.js"); | ||
module.exports = require("./build/cjs/babel-plugin/generate-dictionaries.js"); |
@@ -1,1 +0,1 @@ | ||
module.exports = require("./build/cjs/babel-plugin/generate-index.js"); | ||
module.exports = require("./build/cjs/babel-plugin/generate-index.js"); |
@@ -1,1 +0,1 @@ | ||
module.exports = require("./build/cjs/index.js"); | ||
module.exports = require("./build/cjs/index.js"); |
{ | ||
"name": "@shopify/react-i18n", | ||
"version": "7.6.0", | ||
"version": "7.6.1", | ||
"license": "MIT", | ||
@@ -49,8 +49,7 @@ "description": "i18n utilities for React handling translations, formatting, and more", | ||
"dependencies": { | ||
"@shopify/dates": "^2.0.1", | ||
"@shopify/decorators": "^3.0.1", | ||
"@shopify/dates": "^2.0.2", | ||
"@shopify/function-enhancers": "^3.0.1", | ||
"@shopify/i18n": "^2.0.1", | ||
"@shopify/react-effect": "^5.0.2", | ||
"@shopify/react-hooks": "^3.0.2", | ||
"@shopify/react-hooks": "^3.0.3", | ||
"@shopify/useful-types": "^5.1.1", | ||
@@ -57,0 +56,0 @@ "@types/hoist-non-react-statics": "^3.0.1", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
18
278356
116
4200
- Removed@shopify/decorators@^3.0.1
- Removed@shopify/decorators@3.0.1(transitive)
Updated@shopify/dates@^2.0.2
Updated@shopify/react-hooks@^3.0.3