Created
November 18, 2023 00:53
-
-
Save enagy27/fcfe7e215085f4ace6f7193eb30ce1c2 to your computer and use it in GitHub Desktop.
Before and after comparison of the intl plural helper versus standard ICU format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// before | |
intl.formatMessage( | |
{ | |
id: 'TemplateSearchResults.templates', | |
defaultMessage: | |
'{templatesCount, plural, one {{templatesCount} template} other {{templatesCount} templates}}', | |
description: 'Number of templates in a section', | |
}, | |
{ | |
templatesCount: category.numberOfTemplates, | |
} | |
) | |
// after | |
intl.formatMessage( | |
{ | |
id: 'TemplateSearchResults.templates', | |
defaultMessage: plural('templatesCount', { | |
one: '{templatesCount} template', | |
other: '{templatesCount} templates', | |
}), | |
description: 'Number of templates in a section', | |
}, | |
{ | |
templatesCount: category.numberOfTemplates, | |
} | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment