Skip to content

Comments

i18n: Refactor calypso-products percentages to use numberFormat#100849

Merged
chriskmnds merged 1 commit intotrunkfrom
update/i18n-number-format-percent-calypso-products
Mar 27, 2025
Merged

i18n: Refactor calypso-products percentages to use numberFormat#100849
chriskmnds merged 1 commit intotrunkfrom
update/i18n-number-format-percent-calypso-products

Conversation

@chriskmnds
Copy link
Contributor

@chriskmnds chriskmnds commented Mar 5, 2025

Part of addressing https://github.com/Automattic/i18n-issues/issues/949

Proposed Changes

Refactors calypso-products package to use numberFormat for percentage values.
Several cases that involve plan features, like transaction fees, and other translations where percentages are hardcoded in strings

Media

Transaction fees Before/After in AR:

Screenshot 2025-03-06 at 11 49 24 AM

Why are these changes being made?

Part of addressing https://github.com/Automattic/i18n-issues/issues/949

Testing Instructions

For transaction fees:

  • test between AR/EL/EN locales
  • go to /start/plans and open comparison grid
  • confirm "transition fees" render correctly as in media above

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@github-actions
Copy link

github-actions bot commented Mar 5, 2025

@matticbot
Copy link
Contributor

matticbot commented Mar 5, 2025

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~37 bytes added 📈 [gzipped])

Details
name         parsed_size           gzip_size
entry-main        +223 B  (+0.0%)      +37 B  (+0.0%)
entry-login       +223 B  (+0.0%)      +37 B  (+0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~140 bytes added 📈 [gzipped])

Details
name                                parsed_size           gzip_size
site-purchases                           +404 B  (+0.0%)     +104 B  (+0.0%)
settings-jetpack                         +404 B  (+0.1%)     +104 B  (+0.1%)
settings                                 +404 B  (+0.0%)     +104 B  (+0.0%)
scan                                     +404 B  (+0.0%)     +104 B  (+0.0%)
purchases                                +404 B  (+0.0%)     +104 B  (+0.0%)
purchase-product                         +404 B  (+0.2%)     +104 B  (+0.2%)
plans                                    +404 B  (+0.0%)     +104 B  (+0.0%)
overview                                 +404 B  (+0.0%)     +104 B  (+0.0%)
jetpack-social                           +404 B  (+0.1%)     +104 B  (+0.1%)
jetpack-search                           +404 B  (+0.1%)     +104 B  (+0.1%)
jetpack-connect                          +404 B  (+0.0%)     +104 B  (+0.0%)
jetpack-cloud-settings                   +404 B  (+0.1%)     +104 B  (+0.0%)
jetpack-cloud-pricing                    +404 B  (+0.1%)     +104 B  (+0.0%)
jetpack-cloud-plugin-management          +404 B  (+0.0%)     +104 B  (+0.0%)
jetpack-cloud-partner-portal             +404 B  (+0.0%)     +104 B  (+0.0%)
jetpack-cloud-manage-pricing             +404 B  (+0.1%)     +104 B  (+0.1%)
jetpack-cloud-features-comparison        +404 B  (+0.1%)     +104 B  (+0.1%)
jetpack-cloud-agency-dashboard           +404 B  (+0.0%)     +104 B  (+0.0%)
email                                    +404 B  (+0.0%)     +104 B  (+0.0%)
domains                                  +404 B  (+0.0%)     +104 B  (+0.0%)
checkout                                 +404 B  (+0.0%)     +104 B  (+0.0%)
backup                                   +404 B  (+0.0%)     +104 B  (+0.0%)
a8c-for-agencies-sites                   +404 B  (+0.0%)     +104 B  (+0.0%)
a8c-for-agencies-purchases               +404 B  (+0.1%)     +104 B  (+0.0%)
a8c-for-agencies-overview                +404 B  (+0.0%)     +104 B  (+0.0%)
a8c-for-agencies-marketplace             +404 B  (+0.0%)     +104 B  (+0.0%)
a8c-for-agencies-client                  +404 B  (+0.0%)     +104 B  (+0.0%)
site-setup-flow                          +223 B  (+0.1%)      +36 B  (+0.0%)
onboarding-flow                          +223 B  (+0.1%)      +36 B  (+0.1%)
new-hosted-site-flow-user-included       +223 B  (+0.1%)      +36 B  (+0.1%)
new-hosted-site-flow                     +223 B  (+0.1%)      +36 B  (+0.1%)
hundred-year-plan                        +223 B  (+0.1%)      +36 B  (+0.1%)
hundred-year-domain                      +223 B  (+0.1%)      +36 B  (+0.1%)
connect-domain                           +223 B  (+0.1%)      +36 B  (+0.1%)
async-step-use-my-domain                 +223 B  (+0.0%)      +36 B  (+0.0%)
async-step-unified-plans                 +223 B  (+0.0%)      +36 B  (+0.0%)
async-step-unified-domains               +223 B  (+0.0%)      +36 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~140 bytes added 📈 [gzipped])

Details
name                                             parsed_size           gzip_size
async-load-calypso-blocks-editor-checkout-modal       +404 B  (+0.0%)     +104 B  (+0.0%)
async-load-automattic-help-center-stepper             +223 B  (+0.0%)      +36 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@matticbot
Copy link
Contributor

matticbot commented Mar 5, 2025

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • happy-blocks
  • help-center
  • odyssey-stats

To test WordPress.com changes, run install-plugin.sh $pluginSlug update/i18n-number-format-percent-calypso-products on your sandbox.

@chriskmnds chriskmnds added the [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging label Mar 6, 2025
@chriskmnds chriskmnds marked this pull request as ready for review March 6, 2025 09:51
@chriskmnds chriskmnds requested a review from a team March 6, 2025 09:51
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Mar 6, 2025
@chriskmnds chriskmnds requested a review from rcoll March 6, 2025 09:53
Comment on lines +1105 to +1112
'Print USPS and DHL labels right from the WooCommerce desktop and save up to %(discountPercent)s instantly. WooCommerce Shipping is free and saves you time and money.',
{
args: {
discountPercent: numberFormat( 0.9, {
numberFormatOptions: { style: 'percent' },
} ),
},
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rcoll can you help me test these changes? I couldn't quite figure it out from #90763 - I think it's just missing more detailed testing instructions 🙏

Copy link
Member

@rcoll rcoll Mar 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @chriskmnds - I've taken a look at these three products in A4A and the percentages seem to render as they should. In the case of Accommodations Bookings it looks like the A4A team has removed those particular bullet points, but the others are still there.

You can test this yourself by doing yarn start-a8c-for-agencies on this branch and then navigating to http://agencies.localhost:3000/marketplace/products.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you :-)

@a8ci18n
Copy link

a8ci18n commented Mar 6, 2025

This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/17285377

Some locales (Hebrew) have been temporarily machine-translated due to translator availability. All other translations are usually ready within a few days. Untranslated and machine-translated strings will be sent for translation next Monday and are expected to be completed by the following Friday.

Thank you @chriskmnds for including a screenshot in the description! This is really helpful for our translators.

@chriskmnds chriskmnds force-pushed the update/i18n-number-format-percent-calypso-products branch from 5e8d9f4 to 9e24f2f Compare March 27, 2025 15:28
@chriskmnds chriskmnds merged commit 432d226 into trunk Mar 27, 2025
13 checks passed
@chriskmnds chriskmnds deleted the update/i18n-number-format-percent-calypso-products branch March 27, 2025 16:13
@github-actions github-actions bot removed [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging labels Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants