Skip to content
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

Merged
merged 13 commits into from
Jul 17, 2023

Conversation

WBerredo
Copy link
Contributor

@WBerredo WBerredo commented Jun 9, 2023

Related to #77916

Proposed Changes

Replace Automattic text for a variable containing Automattic SVG in order to avoid the company name being translated

CleanShot 2023-06-12 at 12 33 55@2x

Testing Instructions

This branch

  • On a logged-out tab
  • Go to a page that displays the footer. Ex: /theme/miniature
  • Change the language (Ex: Español) and confirm the name Automattic is not being translated

Prod

  • On a logged-out tab
  • Go to a page that displays the footer. Ex: /theme/miniature
  • Change the language (Ex: Español) and confirm the name Automattic is being translated to automático

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 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-ajp-p2)?

@WBerredo WBerredo added the [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging label Jun 9, 2023
@WBerredo WBerredo self-assigned this Jun 9, 2023
@github-actions
Copy link

github-actions bot commented Jun 9, 2023

@matticbot
Copy link
Contributor

matticbot commented Jun 9, 2023

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

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

name           parsed_size           gzip_size
entry-stepper      +1688 B  (+0.1%)     +110 B  (+0.0%)
entry-main         +1688 B  (+0.1%)     +110 B  (+0.0%)
entry-login        +1688 B  (+0.1%)     +110 B  (+0.0%)

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.
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.

@a8ci18n
Copy link

a8ci18n commented Jun 9, 2023

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();
Copy link
Member

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.

Copy link
Contributor Author

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.

@matticbot
Copy link
Contributor

This PR modifies the release build for happy-blocks

To test your changes on WordPress.com, run install-plugin.sh happy-blocks fix/footer-i18n on your sandbox.

To deploy your changes after merging, see the documentation: PCYsg-r7r-p2

@WBerredo WBerredo requested a review from jsnajdr June 12, 2023 16:04
@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 Jun 12, 2023
@WBerredo WBerredo added [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging and removed [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging labels Jun 12, 2023
@@ -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 >(
Copy link
Member

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"',
Copy link
Member

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.

Copy link
Contributor

@epeicher epeicher left a comment

Choose a reason for hiding this comment

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

I have tested it, and it works as described. Using the Calypso link and changing the language to Español, I cannot see the word Automattic being translated while it is translated in wordpress.com.

LGTM! 🚢
CleanShot 2023-06-13 at 13 35 53@2x

Copy link
Member

@jsnajdr jsnajdr left a comment

Choose a reason for hiding this comment

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

Looks good now 👍

Base automatically changed from fix/ssr-footer to trunk June 13, 2023 13:14
@WBerredo WBerredo added [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging and removed [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging labels Jun 13, 2023
@WBerredo WBerredo added [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging and removed [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. labels Jun 29, 2023
@a8ci18n
Copy link

a8ci18n commented Jul 14, 2023

Translation for this Pull Request has now been finished.

@epeicher epeicher added [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging and removed [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging labels Jul 14, 2023
@WBerredo WBerredo merged commit 10f33f3 into trunk Jul 17, 2023
@WBerredo WBerredo deleted the fix/footer-i18n branch July 17, 2023 12:36
@github-actions github-actions bot removed the [Status] String Freeze Add the [Status] String Freeze label to your PR to ensure new strings are translated before merging label Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants