New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@shopify/react-i18n

Package Overview
Dependencies
Maintainers
25
Versions
289
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@shopify/react-i18n - npm Package Compare versions

Comparing version 0.0.0-snapshot-20221209020050 to 0.0.0-snapshot-20230203161211

31

build/cjs/utilities/translate.js

@@ -19,2 +19,4 @@ 'use strict';

const SEPARATOR = '.';
const UNICODE_NUMBERING_SYSTEM = '-u-nu-';
const LATIN = 'latn';

@@ -43,6 +45,14 @@ const isString = value => typeof value === 'string';

function latinLocale(locale) {
if (!locale) return locale;
return new Intl.Locale(locale, {
numberingSystem: 'latn'
}).toString();
if (!locale) return locale; // Intl.Locale was added to iOS in v14. See https://caniuse.com/?search=Intl.Locale
// We still support ios 12/13, so we need to check if this works and fallback to the default behaviour if not
try {
return new Intl.Locale(locale, {
numberingSystem: LATIN
}).toString();
} catch {
const numberingSystemRegex = new RegExp(`(?:-x|${UNICODE_NUMBERING_SYSTEM}).*`, 'g');
const latinNumberingSystem = `${UNICODE_NUMBERING_SYSTEM}${LATIN}`;
return locale.replace(numberingSystemRegex, '').concat(latinNumberingSystem);
}
}

@@ -133,4 +143,13 @@

if (typeof count === 'number') {
const group = memoizedPluralRules(locale).select(count);
result = result[group] || result.other;
// Explicit 0 and 1 rules take precedence over the pluralization rules
// https://unicode-org.github.io/cldr/ldml/tr35-numbers.html#Explicit_0_1_rules
if (count === 0 && result['0'] !== undefined) {
result = result['0'];
} else if (count === 1 && result['1'] !== undefined) {
result = result['1'];
} else {
const group = memoizedPluralRules(locale).select(count);
result = result[group] || result.other;
}
additionalReplacements[CARDINAL_PLURALIZATION_KEY_NAME] = memoizedNumberFormatter(locale).format(count);

@@ -137,0 +156,0 @@ }

2

package.json
{
"name": "@shopify/react-i18n",
"version": "0.0.0-snapshot-20221209020050",
"version": "0.0.0-snapshot-20230203161211",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "i18n utilities for React handling translations, formatting, and more",

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

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