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

Adds Javascript translation files to jetpack-mu-wpcom #39178

Merged
merged 17 commits into from
Sep 24, 2024

Conversation

d-alleyne
Copy link
Contributor

@d-alleyne d-alleyne commented Sep 1, 2024

Fixes Automattic/i18n-issues#858 and Automattic/wp-calypso#94070

Proposed changes:

  • Adds JavaScript translation files to ensure that the Welcome Guide and Limited Global Styles and Page Patterns selector are fully translated.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Sandbox a simple site
  • Execute bin/jetpack-downloader test jetpack fix/etk-translation-issues && bin/jetpack-downloader test jetpack-mu-wpcom-plugin fix/etk-translation-issues to release these changes on the sandbox
  • Verify that the Global Styles, Welcome Guide, and Page Patterns selector are localized

Copy link
Contributor

github-actions bot commented Sep 1, 2024

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WordPress.com Simple site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin, and enable the fix/etk-translation-issues branch.

    • For jetpack-mu-wpcom changes, also add define( 'JETPACK_MU_WPCOM_LOAD_VIA_BETA_PLUGIN', true ); to your wp-config.php file.
  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack-mu-wpcom-plugin fix/etk-translation-issues
    

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added the [Package] Jetpack mu wpcom WordPress.com Features label Sep 1, 2024
Copy link
Contributor

github-actions bot commented Sep 1, 2024

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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 🤖


The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available.


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Choose a review path based on your changes:
    • A. Team Review: add the "[Status] Needs Team Review" label
      • For most changes, including minor cross-team impacts.
      • Example: Updating a team-specific component or a small change to a shared library.
    • B. Crew Review: add the "[Status] Needs Review" label
      • For significant changes to core functionality.
      • Example: Major updates to a shared library or complex features.
    • C. Both: Start with Team, then request Crew
      • For complex changes or when you need extra confidence.
      • Example: Refactor affecting multiple systems.
  3. Get at least one approval before merging.

Still unsure? Reach out in #jetpack-developers for guidance!

anomiex
anomiex previously requested changes Sep 6, 2024
Copy link
Contributor

@anomiex anomiex left a comment

Choose a reason for hiding this comment

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

It would be really nice if this could be handled through translate.wordpress.com instead of dumping 693 files into the repository. Is there really no other way to do this?

@d-alleyne
Copy link
Contributor Author

It would be really nice if this could be handled through translate.wordpress.com instead of dumping 693 files into the repository. Is there really no other way to do this?

This was meant to be a workaround until we can import these strings into a jetpack-mu-wpcom project on translate.wordpress.com. I'll discuss it with @yuliyan and @dlind1

@mmtr
Copy link
Member

mmtr commented Sep 23, 2024

Not sure if I'm missing something, but I don't get this to work after applying the changes to my sandbox:

Screenshot 2024-09-23 at 13 45 04

It would be really nice if this could be handled through translate.wordpress.com instead of dumping 693 files into the repository. Is there really no other way to do this?

Yeah, I agree. Also, what would be the process if we add new translatable strings to the code or if we modify existing ones?

This was meant to be a workaround until we can import these strings into a jetpack-mu-wpcom project on translate.wordpress.com. I'll discuss it with @yuliyan and @dlind1

Do you have any update about that project?

@d-alleyne d-alleyne force-pushed the fix/etk-translation-issues branch from 2236cae to c895a53 Compare September 24, 2024 14:27
Copy link
Contributor

@anomiex anomiex left a comment

Choose a reason for hiding this comment

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

@mmtr has some good questions in #39178 (comment).

I hope Automattic/i18n-issues#875 doesn't wind up being forgotten about, and doesn't change course such that this workaround becomes permanent.

Comment on lines +38 to +40
if ( preg_match( $pattern, $relative ) ) {
$relative = preg_replace( $pattern, '', $relative ); // Remove the environment prefix
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be simplified to

Suggested change
if ( preg_match( $pattern, $relative ) ) {
$relative = preg_replace( $pattern, '', $relative ); // Remove the environment prefix
}
$relative = preg_replace( $pattern, '', $relative ); // Remove the environment prefix

?

@d-alleyne
Copy link
Contributor Author

I hope Automattic/i18n-issues#875 doesn't wind up being forgotten about, and doesn't change course such that this workaround becomes permanent.

Actually, a draft post is being written, based on pxLjZ-955-p2 to see if we can keep this and other mu plugins updated.

@mmtr
Copy link
Member

mmtr commented Sep 24, 2024

what would be the process if we add new translatable strings to the code or if we modify existing ones?

This wasn't answered. Am I correct assuming that there won't be any process to update the translations while this workaround is live?

@d-alleyne can you clarify this too? Thanks.

@mmtr mmtr requested review from yuliyan and dlind1 September 24, 2024 15:27
@d-alleyne
Copy link
Contributor Author

Am I correct assuming that there won't be any process to update the translations while this workaround is live?

Correct. This release is meant to allow users to see localized text, rather than English in their MAG-16 locale.

@anomiex
Copy link
Contributor

anomiex commented Sep 24, 2024

I hope Automattic/i18n-issues#875 doesn't wind up being forgotten about, and doesn't change course such that this workaround becomes permanent.

Actually, a draft post is being written, based on pxLjZ-955-p2 to see if we can keep this and other mu plugins updated.

The text there says

However, creating a unified script for downloading language packs could be beneficial, as it would allow for easier integration into any plugin that consumes the translations.

It's not clear to me whether that means creating a unified script for wpcom environments (Simple and WoA) to download the language packs where needed like Core does for translations from translate.wordpress.org, or creating a unified script to make the workaround here (i.e. copying the translations into the repo) permanent and updated.

@dlind1
Copy link
Contributor

dlind1 commented Sep 24, 2024

It's not clear to me whether that means creating a unified script for wpcom environments (Simple and WoA) to download the language packs where needed like Core does for translations from translate.wordpress.org, or creating a unified script to make the workaround here (i.e. copying the translations into the repo) permanent and updated.

As part of the decision process for implementing an automatic translation process we'd decide whether the translation files would be bundled with the plugin or downloaded using the process similar to what's used for translate.wordpress.org.

Using the translate.wordpress.org-like approach would simplify the process for releasing the plugins, but from our experience the translations are not always being fetched automatically, so that'd have to be addressed. Bundling the translations in the repository works pretty well for wpcomsh and wc-calypso-bridge and is a safe alternative if the other approaches won't be feasible.

@d-alleyne d-alleyne merged commit c8c3ec5 into trunk Sep 24, 2024
55 checks passed
@d-alleyne d-alleyne deleted the fix/etk-translation-issues branch September 24, 2024 17:13
@github-actions github-actions bot removed [Status] In Progress [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels Sep 24, 2024
d-alleyne added a commit that referenced this pull request Sep 24, 2024
d-alleyne added a commit that referenced this pull request Sep 24, 2024
@d-alleyne d-alleyne restored the fix/etk-translation-issues branch September 24, 2024 23:19
gogdzl pushed a commit that referenced this pull request Oct 25, 2024
* Add Language Pack JSON files

* Rename language files

* changelog

* Load javascript translations

* Add Spanish Translations for the Welcome Guide

* Adjust relative paths so that the md5 calculation is the same on Atomic and Simple sites

* Remove unnecessary usages of `_x()` in favor of `__()`

* Create symlink file for Simple Site

The locale on Simple Sites is `es` rather than `es_ES`

* Rename files so that their locales and MD5 hashes work on Simple and Atomic sites

* Add the translation directory for the Global Styles

* Update JSON files and code to use a 'workaround' context

See #39324 (comment)
for more details

* Add Global Styles translation files

* Add symlinks for Simple Sites

Bugfix

* Bugfix

* Add Translations for Page Patters selector

See Automattic/wp-calypso#94070

* Revert unused changed

* Remove unused JSON files
gogdzl pushed a commit that referenced this pull request Oct 25, 2024
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