Skip to content

Environments: Add translate.wordpress.org local dev stack#630

Open
dd32 wants to merge 1 commit into
WordPress:trunkfrom
dd32:translate-environment
Open

Environments: Add translate.wordpress.org local dev stack#630
dd32 wants to merge 1 commit into
WordPress:trunkfrom
dd32:translate-environment

Conversation

@dd32
Copy link
Copy Markdown
Member

@dd32 dd32 commented May 12, 2026

Summary

  • Adds environments/translate/ — a wp-env stack mirroring production's active plugin/theme set on translate.wordpress.org, with mu-plugin polyfills so it can run single-site.
  • after-start.sh seeds the GlotPress project tree (wp/dev at project_id=2, wp-plugins, wp-themes, plus the meta/apps/patterns/waiting stubs the wporg-gp-* plugins expect), 12 locales, admin permissions, and the wporg-gp-custom-stats extra tables.
  • npm run translate:import -- <plugin|theme> <slug> pulls strings directly from translate.wordpress.org's export-translations endpoint. Plugins follow the production dev / dev-readme (+ stable / stable-readme) layout; themes flat.

Test plan

  • cd environments && npm install && npm run translate:env start completes cleanly
  • Homepage renders the locale grid with the 12 seeded locales
  • /stats/ shows populated columns
  • /locale/<locale>/default/wp-plugins/ lists hello-dolly with the prod translation counts
  • npm run translate:import -- plugin akismet creates dev / dev-readme (+ stable / stable-readme) sub-projects and pulls translations for all 12 seeded locales

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings May 12, 2026 05:39
@github-actions
Copy link
Copy Markdown

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

Core Committers: Use this line as a base for the props when committing in SVN:

Props dd32.

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new environments/translate/ wp-env stack intended to mirror translate.wordpress.org locally (single-site), including startup seeding for a GlotPress project tree/locales and a CLI importer to pull strings/translations from translate.wordpress.org.

Changes:

  • Introduces a translate.wordpress.org local wp-env config and lifecycle afterStart seeding script.
  • Adds a WP-CLI eval-file importer to create local GlotPress projects and import .po originals/translations from translate.wordpress.org.
  • Adds mu-plugin polyfill stubs and SQL to create extra stats tables required by wporg-gp-custom-stats, plus docs and npm scripts to run the environment.

Reviewed changes

Copilot reviewed 6 out of 9 changed files in this pull request and generated no comments.

Show a summary per file
File Description
environments/translate/.wp-env.json Defines the new translate wp-env stack (plugins/themes/mappings/config + afterStart hook).
environments/translate/bin/after-start.sh Automates plugin activation, GlotPress schema init, project tree + locale seeding, fixture imports, and stats rebuild.
environments/translate/bin/import-from-wporg.php Imports project structure and translations from translate.wordpress.org into the local GlotPress DB.
environments/translate/bin/extra-tables.sql Creates extra custom-stats tables expected by production plugins.
environments/mocks/mu-plugins/mu-plugins-loader.php Adds polyfills/defines for constants/functions expected by wporg translate plugins in single-site wp-env.
environments/mocks/mu-plugins/rosetta-network/roles/cross-locale-pte.php Stubs Cross_Locale_PTE to allow wporg-gp-rosetta-roles to load locally.
environments/package.json Adds translate:* npm scripts to start/import/refresh the translate environment.
environments/README.md Documents how to start and use the new translate environment and importer.
environments/.gitignore Ignores .wp-env.override.json overrides for local environment tweaks.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Adds an `environments/translate/` wp-env config that mirrors production's
active plugin/theme set and seeds GlotPress with the project tree, locales,
and stub fixtures the wporg-gp-* plugins expect (wp/dev at project_id=2,
wp-plugins, wp-themes, meta/*, apps/*, patterns/*, waiting). Plugin imports
follow translate.wordpress.org's dev / dev-readme layout and pull strings
directly from the production export-translations endpoint.

Also adds mu-plugin polyfills for production-only globals so the env can run
single-site (WPORGPATH, WP_CORE_STABLE_BRANCH, get_sites, WPORG_GLOBAL_NETWORK_ID)
and a no-op Cross_Locale_PTE stub for the rosetta-network mu-plugin that
isn't in this repo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@dd32 dd32 force-pushed the translate-environment branch from 70d4fff to 3e83b8c Compare May 12, 2026 05:54
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.

2 participants