New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
i18n: Don't rewrite blog post URLs #43610
Conversation
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~246 bytes added 📈 [gzipped])
Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used. 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. Generated by performance advisor bot at iscalypsofastyet.com. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, works fine!
client/lib/i18n-utils/utils.js
Outdated
if ( | ||
typeof limitPathMatch === 'object' && | ||
limitPathMatch instanceof RegExp && | ||
! urlParts.pathname.match( limitPathMatch ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nitpick: I'd use limitPathMatch.test( urlParts.pathname )
as it's a better fit in this use case (also has better performance, even though it probably won't be noticeable here).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Changed it.
client/lib/i18n-utils/utils.js
Outdated
if ( typeof validLocales === 'string' ) { | ||
validLocales = config( validLocales ); | ||
} | ||
|
||
if ( typeof limitPathMatch === 'object' && limitPathMatch instanceof RegExp ) { | ||
if ( ! urlParts.pathname.match( limitPathMatch ) ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
limitPathMatch.test( urlParts.pathname )
- same as above
The “Learn More” link on the Jetpack > Activity Log page 404’s when using a language that has a language WordPress.com blog.
Fails: https://wordpress.com/es/blog/2018/10/30/introducing-activity/
Works: https://wordpress.com/blog/2018/10/30/introducing-activity/
props for discovering @cathymcbride
Changes proposed in this Pull Request
localizeUrl()
should not rewrite blog post URLs since we don't have all posts translated and currently no english-slug redirects in place.Testing instructions
yarn run test-client lib/i18n-utils