-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Footer i18n: Update footer branding to be well supported in multiple languages #78018
Conversation
…l state for components" This reverts commit 9a94552.
…taining Automattic
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: App Entrypoints (~110 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. |
This Pull Request is now available for translation here: https://translate.wordpress.com/deliverables/8035323 Thank you @WBerredo for including a screenshot in the description! This is really helpful for our translators. |
]; | ||
|
||
const branding = automatticRoger[ Math.floor( Math.random() * ( 10 - 0 + 1 ) + 0 ) ]; | ||
const branding = automatticRoger[ Math.floor( Math.random() * ( 10 - 0 + 1 ) + 0 ) ]?.toString(); |
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.
I'm wondering what these ±0
arithmetics are supposed to achieve. To select a random array element, seems to me that simple roger[ Math.floor( Math.random() * roger.length ) ]
is sufficient.
Also, once you avoid the .split
call and use interpolation to insert the A8c logo, the .toString
call is no longer needed. In theory branding
can be a HTML/JSX markup then.
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.
I'm wondering what these ±0 arithmetics are supposed to achieve. To select a random array element, seems to me that simple roger[ Math.floor( Math.random() * roger.length ) ] is sufficient.
Agreed, I'm also not sure why are they needed, but I suppose it must be needed as it is a non-trivial addition.
This PR modifies the release build for happy-blocks To test your changes on WordPress.com, run To deploy your changes after merging, see the documentation: PCYsg-r7r-p2 |
9f23df3
to
3968c13
Compare
@@ -477,7 +464,9 @@ const UniversalNavbarFooter = ( { | |||
const isEnglishLocale = useIsEnglishLocale(); | |||
const pathNameWithoutLocale = | |||
currentRoute && removeLocaleFromPathLocaleInFront( currentRoute ).slice( 1 ); | |||
const [ automatticBranding, setAutomatticBranding ] = useState( { article: '', noun: '' } ); | |||
const [ automatticBranding, setAutomatticBranding ] = useState< React.ReactChild >( |
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.
The React.ReactChild
type (or rather React.JSX.Element
) will be automatically inferred from the default value, doesn't need to be specified.
export const getAutomatticBrandingNoun = ( translate: typeof translateMethod ) => { | ||
const options = { | ||
description: | ||
'Branding to be shown on the Footer of the page, Automattic\'s variable will always contains the word "Automattic"', |
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.
This options.description
field, will it be correctly extracted by the i18n
tool? I have some doubts about that. We might have to repeat it verbatim for every variant, however ugly that is.
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.
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.
Looks good now 👍
Translation for this Pull Request has now been finished. |
Related to #77916
Proposed Changes
Replace
Automattic
text for a variable containing Automattic SVG in order to avoid the company name being translatedTesting Instructions
This branch
Español
) and confirm the name Automattic is not being translatedProd
Español
) and confirm the name Automattic is being translated toautomático
Pre-merge Checklist