Environments: Add translate.wordpress.org local dev stack#630
Conversation
|
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 Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
There was a problem hiding this comment.
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
afterStartseeding script. - Adds a WP-CLI eval-file importer to create local GlotPress projects and import
.pooriginals/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>
70d4fff to
3e83b8c
Compare
Summary
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.shseeds the GlotPress project tree (wp/dev atproject_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'sexport-translationsendpoint. Plugins follow the productiondev/dev-readme(+stable/stable-readme) layout; themes flat.Test plan
cd environments && npm install && npm run translate:env startcompletes cleanly/stats/shows populated columns/locale/<locale>/default/wp-plugins/lists hello-dolly with the prod translation countsnpm run translate:import -- plugin akismetcreatesdev/dev-readme(+stable/stable-readme) sub-projects and pulls translations for all 12 seeded locales🤖 Generated with Claude Code