i18n: Introduce i18n-calypso for formatting currencies#42317
i18n: Introduce i18n-calypso for formatting currencies#42317chriskmnds wants to merge 2 commits intotrunkfrom
Conversation
| Are you an Automattician? The PR will need to be tested on WordPress.com. This comment will be updated with testing instructions as soon the build is complete. |
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCannot generate coverage summary while tests are failing. 🤐 Please fix the tests, or re-run the Code coverage job if it was something being flaky. |
jeherve
left a comment
There was a problem hiding this comment.
Historically, we've purposefully tried to steer away from i18n-calypso in this monorepo, and instead use Core's @wordpress/i18n whenever possible. Among other things, it makes it possible to handle translations via Core's language packs.
You can see #16481 for more info on that.
This is also why we removed the i18n-calypso dependency from @automattic/format-currency a few years back, in Automattic/wp-calypso#62854
Moving away from @automattic/format-currency and back to i18n-calypso feels like a step back, and will introduce problems with localization.
I assume you're making this change as part of https://github.com/Automattic/i18n-issues/issues/939 / pxLjZ-9Eg-p2 ?
Instead of moving everything to i18n-calypso, would it be an option to do the opposite and keep currency formatting i18n-calypso free, so we can continue to rely on Core translations (and thus core language packs and the existing translation process and workflow used by our i18n team and our paid translators) for the different Jetpack plugins developed in the Jetpack monorepo?
Hey @jeherve . I intend to deprecate the Now Jetpack remains to follow along the same path. It's not only format-currency (that's also been sitting in legacy/v1 in JP for years), but also the You can see the second milestone there is:
So what you are asking is the "longer path" - to create a separate number-formatters package. Are you absolutely categorical/against using Quoting myself:
We've done several refactors in |
That's fine, that sounds like a nice goal! We would definitely all benefit from an up-to-date, maintained, central solution we can all use. Does that single package have to be We've tried very hard to stay away from We've also discussed about moving away from If the number-formatters functions you've been working on do not deeply rely on core |
|
Thanks @jeherve
It doesn't, although it does feel to me that we have a few too many decentralised components for i18n. I don't have a strong opinion other than that I'd prefer one vs many down the line. JP having been sitting on v1 format-currency all this time adds more to that concern I think. p.s. do we have a similar system/concept in Jetpack to wp-calypso for packages, tag and publish to NPM, etc? Would your preference be to host a number-formatters in Jetpack, if so? 🤔 |
|
I strongly agree with @jeherve: We've long avoided using A separate package for number and currency formatting would be fine with us, as long as any i18n it does gets picked up properly using GlotPress (meaning that it probably needs to either use
We do! And, IMNSHO, we have better infrastructure around releasing and deploying. 🙂 Each project under On the other hand, we haven't done too well yet with setting up TypeScript packages correctly for publishing in a way friendly to reusers (but #41536 is getting there for
If you want to develop it here, we'd be happy to host it. 🙂 |
|
Thanks @anomiex
I hope this isn't more concerning than it sounds 😁 |
Mostly it means that many of our packages offer Also a bunch of our packages probably use |
Ok. Thanks. Do you know off-hand if I will need to worry about that with consuming in wp-calypso (so being the main reuser)? |
|
When putting together your new project, you can do it right from the start to avoid there being any problems. There's nothing in the monorepo that will stop you, it's only that people didn't do it when setting up other JS packages because, within the monorepo, we have the build toolchains set up to compile the TS already. If you decide to go ahead with a js-package in the Jetpack monorepo, I'll be happy to help get it set up. 🙂 |
Thanks @anomiex! I appreciate your offer to help. We had a bit of a chat with @dlind1 in Slack about this, and we will make an attempt to go with Jetpack. I think it might help us, considering we don't stumble nto any major blockers / maintenance hurdles. You can see our reasoning and some concerns here: p1742206025742309/1742141248.562769-slack-C74C3THK7 I'll tag you in a PR to provision the new package. Hopefully you can help us clarify how updates/maintenance will happen, testing changes, also testing them in wp-calypso, etc. |
Releases to NPM generally happen automatically whenever a plugin in the monorepo that uses the package (directly or indirectly) is released. So if it winds up being used in Jetpack-the-plugin, that'll generally be at least weekly due to the weekly Jetpack releases for Atomic. There are also instructions for releasing the package directly if needed (PCYsg-Np7-p2). Maintenance of the code is mainly up to whichever developers own the code, I can't really speak to that. If no devs are specifically paying attention, it'll still get some incidental updates as we bump dependencies via Renovate, update eslint configs, and so on.
Our main method of JS testing in the monorepo is unit testing with jest. Although if you really want (and will maintain it) you could set up something else; as far as monorepo tooling is concerned, the package just needs to have a composer.json file with Beyond that we don't have much existing. We have some in-monorepo E2Es for plugins, so you might test the package-as-exposed-by-a-plugin that way. The
Beyond the E2Es mentioned above, we don't have anything set up for this. For manual testing I suppose you'd have to use yarn's equivalent of |
|
If you'd rather stick with development in the Calypso repo, we can work with that too. It sounds like the main things to keep in mind with that are sticking with |
|
Thanks @anomiex ! That's very useful info.
Yes, we have unit tests.
That's gold.
I think it should suffice for a Calypso dev wanting to make some changes to the module. I also hope it won't be a common case beyond the initial release - these components are already fairly stable.
I think for now we'll stick (or start) with Jetpack and see how it goes. We don't expect much development on this package beyond the initial release. Well, in theory! I will make sure to add detailed instructions on developing with both repos once I get the handle on it. Thank you for the generous insight! :-) |
|
Closing. Thanks for the input/discussion |
Fixes #
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: