@shopify/react-i18n
Advanced tools
Comparing version 7.5.1 to 7.6.0
@@ -141,4 +141,13 @@ 'use strict'; | ||
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); | ||
@@ -145,0 +154,0 @@ } |
@@ -14,3 +14,3 @@ import { Replacements } from './types'; | ||
} | ||
export declare type I18nError = MissingTranslationError | MissingReplacementError | MissingCurrencyCodeError | MissingCountryError; | ||
export type I18nError = MissingTranslationError | MissingReplacementError | MissingCurrencyCodeError | MissingCountryError; | ||
//# sourceMappingURL=errors.d.ts.map |
import React from 'react'; | ||
import { I18n } from './i18n'; | ||
import { RegisterOptions } from './manager'; | ||
declare type Result = [I18n, React.ComponentType<{ | ||
type Result = [I18n, React.ComponentType<{ | ||
children: React.ReactNode; | ||
@@ -6,0 +6,0 @@ }>]; |
@@ -7,3 +7,3 @@ import { I18nDetails, TranslationDictionary, MaybePromise } from './types'; | ||
} | ||
declare type TranslationGetter = (locale: string) => MaybePromise<TranslationDictionary | undefined>; | ||
type TranslationGetter = (locale: string) => MaybePromise<TranslationDictionary | undefined>; | ||
interface TranslationMap { | ||
@@ -10,0 +10,0 @@ [key: string]: MaybePromise<TranslationDictionary | undefined>; |
@@ -26,5 +26,5 @@ /// <reference types="react" /> | ||
} | ||
export declare type MaybePromise<T> = T | Promise<T>; | ||
export type MaybePromise<T> = T | Promise<T>; | ||
export { CurrencyCode } from './currencyCode'; | ||
export declare type Replacements = PrimitiveReplacementDictionary | ComplexReplacementDictionary; | ||
export type Replacements = PrimitiveReplacementDictionary | ComplexReplacementDictionary; | ||
//# sourceMappingURL=types.d.ts.map |
{ | ||
"name": "@shopify/react-i18n", | ||
"version": "7.5.1", | ||
"version": "7.6.0", | ||
"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
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
281939
4248