All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and adheres to Semantic Versioning.
- Fixed babel helpers file being generated with incorrect filename in esm build. [#2082]
- Updated regex for humanized timezones to include offsets #2077
- Migrate from
sewing-kit-next
toloom
for building - package build output remains identical. [#2039]
- No updates. Transitive dependency bump.
- No updates. Transitive dependency bump.
- Added
with-explicit-paths
option to babel plugin. #1973
- Enable type checking in tests and fix type errors. [#2011]
- No updates. Transitive dependency bump.
- Fix format currency double negative bug in nordic regions [#2004]
- Updated build tooling, types are now compiled with TypeScript 4.3. [#1997]
- Update dependency on
change-case
. [#1990]
- Update to latest sewing-kit-next for build. Update
types
/typesVersions
fields to point directly into the build folder [#1980]
- Makes humanized short timezones uppercase. #1977
- added back
toLocalLowerCase
to humanized times. #1972 removed it which causedam
andpm
to be capitalized in some cases #1976
- Fixed issue where humanized date options were repeated and not properly capitalized #1972
- Officially supports React
17.x
1969
- No updates. Transitive dependency bump.
- Update
@babel/core
to^7.14.6
#1948
- Update
fs-extra
to^9.1.0
#1946
- Update minimum supported node version to 12.14.0. Add engines field to help enforce usage of this version. #1906
- Updated
currencyDecimalSymbol
to handle mismatched locale/currency #1912
- Added a
none
option to theCurrencyFormatOptions
that returns a currency-formatted string without a currency symbol #1907
- Fixed higher chance of id collision caused by trimming of generated hashes in babel-plugin #1905
- Fixed
currencyDecimalSymbol
function returningDECIMAL_NOT_SUPPORTED
for RSD #1902
- Removed dependency on tslib, as we no-longer compile with
tsc
. #1829
- Error when you don't pass a filename to babel when using the babel plugin. Updated types within babel-plugin so it passes TypeScript's "noImplicitThis" checks. #1814
- Fixed issue where humanized date for today may be reported as tomorrow #1797
- Fixed bug in
unformatNumber
that caused the minus sign to be removed from negative numbers #1758 - Made private method
numberSymbols
public #1758
- Updated multi-build outputs to include mandatory extensions to fix "Module not found" issues reported by ESM supported bundlers #1759
- Add new build outputs (CommonJS, ESM, esnext, Node) for greater tree-shakability #1698
- Fix bug in
getTranslationTree
when having multiple translation dictionaries. #1662 - Remove unused
noop
util helper #1669
- Updated
tslib
dependency to^1.14.1
. #1657
- Fixed
DateStyle.Humanize
's handling of time zones for dates that are yesterday, today, or tomorrow [#1623]
- Fixed (updated) currencies list. [#1632]
-
Adds future date formatting to
formatDate
for dates less than 1 week away and less than 1 year away [#1438]Please see the migration guide for more information.
-
Updated
I18n#humanizeDate
to humanize today's date asToday at {time}
[#1459]Please see the migration guide for more information.
- Fixed
DateStyle.Short
zero-padding days (#1468)
-
Modified
I18n#humanizeDate
to humanize future dates, specificallyTomorrow at {time}
[#1391]Please see the migration guide for more information.
jest.Matchers
type updated to match@types/jest
version25
[#1239]
- updated
memoizedNumberFormatter
to support allIntl.NumberFormat
constructor inputs (#1366)
- adding additional exports:
RegisterOptions
,CurrencyFormatOptions
,NumberFormatOptions
,TranslateOptions
,RootTranslateOptions
,Replacements
(#1365)
- Updated
formatCurrency
to usememoizedNumberFormatter
to eliminate memory leak (#1310)
- Removed the unicode
RegExp
flag ongetCurrencySymbol
in order to support IE11 (#1363)
- Add
defaultLocale
option to Babel plugin (#1225) - Added
form: 'auto'
option toformatCurrency
, to automatically selectshort
orexplicit
based oncurrency
anddefaultCurrency
(#1350)
- Added korean eastern name formatter
- Added
hasEasternNameOrderFormatter
method, to determine whether an Eastern name order formatter exists for the locale/language
-
Fixed memory leaks when server-side rendering for
Intl.DateTimeFormat.format()
andIntl.NumberFormat.format()
(#1287) -
formatCurrency
will now put the minus sign in front of the currency symbol when the amount is negative (#1264)
MissingTranslationError
now uses thenormalizedId
which includes thescope
(#1258)
- Added
Gip
currency code value (#1235)
- Fixed
unformatNumber
for numbers using a period as the thousand separator (#1215)
- Minor - added a
generateTranslationDictionaries
helper, andmode=from-dictionary-index
option for the Babel plugin. This can be used to build many versions of an application, with each version containing a specific locale's translations directly within JavaScript (#1197)
- Added a
generateTranslationIndexes
helper, andmode=from-generated-index
option for the Babel plugin. This can be used to resolve unwanted cache hits when adding new translation files (#1188)
translationKeyExists
on i18n works as expected with onError handler (#1162)
- Added locale to be part of
MissingTranslationError
(#1178)
- Added
memoizedPluralRules
utility function (#1065 - Added
memoizedNumberFormatter
utility function (#1065
- Removed leading zero from hours of time output by
I18n#humanizeDate
method (#1093)
- Removed creation of
Intl.PluralRules
object fromI18n
constructor which caused backwards incompatibility for any platforms needing a polyfill forIntl.Plualrules
support (#1065
- Added displayName to
withI18n
decorator to help with debugging (#1048)
- Fixed babel plugin incompatiblity with jest code coverage
-
Modified translation keys used by
I18n#humanizeDate
method (#1011).Please see the migration guide for more information.
-
Added
ordinal
method to I18n class to translate ordinal numbers (#1003)Consumers will need to add the following translation keys for proper ordinal translation. Note: values are English examples.
{ "ordinal": { "one": "{number}st", "two": "{number}nd", "few": "{number}rd", "other": "{number}th" } }
- Replaced
@shopify/javascript-utilities/dates
functions with those from@shopify/dates
. - Removed
@shopify/javascript-utilities/dates
dependency.
- Fixed translation of weekday in
humanizeDate
for dates less than one week old.
- Updated to
@shopify/dates@^0.2.0
- Added support for pluralization to
getTranslationTree
(#988)
- Added
form:
option (one ofshort
|explicit
) toformatCurrency()
(#916)
- Added
formatName
method to I18n class to format a first name and/or last name based on the locale used. (#834)
- Added an optional replacements argument to
getTranslationTree
(#874)
- Fixed an issue where async translations would sometimes not be shown on the initial mount of a component (#824)
- Added
loading
property to I18n class. This helps to determine loading states when retrieving translations async on apps that are rendered client-side.
- Added
translationKeyExists
method for checking dynamic keys (#766)
- Added missing dependency for memoize function (#746)
- The Babel plugin now fails when multiple components in a single file attempt to import translations, as this can cause build issues in Webpack (#734)
- The Babel plugin now does not attempt to load asynchronous translations for locales do not have dedicated translation files (#738)
- Fixes transpilation for
babel-preset-typescript
when the last import pulls in only type definitions (#699)
- Now exports formerly missing typings for
TranslationDictionary
(#693)
- Added
getTranslationTree
to get the translation tree from a key (#645)
- Fixed a number of performance issues with resolving asynchronous translations (#659)
Weekdays
renamed toWeekday
as part ofshopify/typescript/prefer-singular-enums
eslint rule (#648)
- Added a
useSimpleI18n
hook for performantly sharing an i18n instance within a React subtree (#639)
- Improved the typing of
withI18n
to no longer mark thei18n
prop as required (#639)
This library now requires React 16.8.
- Added a
useI18n
hook as the new first-class API (#547)
- Refactored the way parent/ child translations were stored, which should slightly improve performance (#547)
- Fixed an issue where the Babel plugin would return
Module
objects instead of the actual translation dictionaries #618
- Memoize
Intl.DateTimeFormat
andIntl.NumberFormat
#596
- Expose
currencyDecimalPlaces
andDEFAULT_DECIMAL_PLACES
#590
- Support unexpected usage of decimal symbols in
I18n#unformatCurrency
#577
- Reverted a change that caused
I18n#getCurrencySymbol
to sometimes return an empty string
- Added an optional
onError
field to the options forI18nManager
, which controls how descendantI18n
objects will respond to some types of recoverable errors #550
- Fixed an issue where
I18n
instances would be created with two copies of each translation dictionary when the locale was equal to the fallback locale #553
- Babel plugin now correctly works without
filenameRelative
being passed viaopts
.
- Babel plugin was added to auto-generate the arguments for
withI18n
when an adjacenttranslations
folder exists #505
MissingTranslationError
now prints the missing translation as part of the message #497
- Async translations that do not resolve to a translation dictionary are now serialized correctly #494
- Multiple instances of the same component now reuse an inflight promise for translations #498
- Upgraded to the latest version of
react-effect
. This version has some breaking changes, but this does not actually change any API inreact-i18n
. #477
- Add
unformatCurrency
utility to return the normalized value of formatted currency #486
CurrencyCode
enum types #473
- Format count when handling pluralized translation #447
- Start of Changelog