Skip to content

[Blueprints] Localize starter content using an initial setSiteLanguage step - #4515

Open
akirk wants to merge 1 commit into
trunkfrom
feat/localized-wordpress-install
Open

akirk wants to merge 1 commit into
trunkfrom
feat/localized-wordpress-install

Conversation

@akirk

@akirk akirk commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

An initial setSiteLanguage step now determines the language used to install a fresh WordPress site, so its starter post, page, comment, and category are created in that language. Localized installations use WordPress’s translated “My Site” title. Blueprint v1 preparses only the first executable step, ignoring comments and disabled entries; the step still executes normally afterward to translate installed plugins and themes. Later language steps retain their normal ordering. The v1 schema and setSiteLanguage implementation are unchanged.

Standard Playground bundles already contain an English database, so localized fresh installs omit that factory database during extraction and install from scratch. Existing mounted databases and custom site archives are preserved. CLI localized installs bypass the cache of previously installed sites while retaining release-download caching. This PR starts from trunk and complements #4505 without overlapping files: explicit locales work independently, while "browser" requires #4505 for the subsequent normal step execution. The legacy PHP boot path is unchanged.

Validation:

  • Blueprint preparsing and bundle tests: 6 passed.
  • Blueprint compiler tests: 78 passed.
  • Client boot tests: 13 passed; remote worker tests: 9 passed.
  • Locale resolution tests: 6 passed.
  • PHP/SQLite integration: verified German starter content and title, then preserved custom content while overlaying another factory bundle.
  • Lint and type checks passed for the affected packages (including a separate WordPress test type check).

Summary by CodeRabbit

  • New Features
    • Blueprint v1 now supports installing a fresh WordPress site in a specified language, including translated starter content.
    • Browser language preferences can be used to select an available installation language, with English as a fallback.
    • Existing sites retain their saved language, title, and content when reopened.
  • Documentation
    • Added guidance on how Blueprint step order affects language selection and translated starter content.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 8d9b0108-bc02-4963-8012-09a571a25c9b
Commits

Reviewing files that changed from the base of the PR and between e360f7c and 44057e0.

Files selected for processing: 16
  • packages/docs/site/docs/blueprints/03-data-format.md
  • packages/playground/blueprints/src/lib/resolve-runtime-configuration.ts
  • packages/playground/blueprints/src/lib/types.ts
  • packages/playground/blueprints/src/lib/v1/compile.ts
  • packages/playground/blueprints/src/tests/installation-language.spec.ts
  • packages/playground/cli/src/blueprints-v1/blueprints-v1-handler.ts
  • packages/playground/cli/src/blueprints-v1/worker-thread-v1.ts
  • packages/playground/client/src/blueprints-v1-handler.spec.ts
  • packages/playground/client/src/blueprints-v1-handler.ts
  • packages/playground/remote/src/lib/blueprints-worker.ts
  • packages/playground/remote/src/lib/playground-worker-endpoint.ts
  • packages/playground/wordpress/src/boot.ts
  • packages/playground/wordpress/src/index.ts
  • packages/playground/wordpress/src/installation-language.ts
  • packages/playground/wordpress/src/test/installation-language-resolution.spec.ts
  • packages/playground/wordpress/src/test/installation-language.spec.ts

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 3 remain after this review.

Walkthrough

Blueprint v1 now passes the language from its first executable setSiteLanguage step to WordPress boot. WordPress can load translations and create localized starter content during a fresh installation. Existing installations retain their stored language and content.

Changes: Localized Blueprint Installation

Layer / File(s) Summary
Resolve the Blueprint installation language
packages/playground/blueprints/src/lib/types.ts, packages/playground/blueprints/src/lib/v1/compile.ts, packages/playground/blueprints/src/lib/resolve-runtime-configuration.ts, packages/playground/blueprints/src/tests/installation-language.spec.ts, packages/docs/site/docs/blueprints/03-data-format.md
The compiler captures the language from the first executable setSiteLanguage step and exposes it through runtime configuration. Tests cover step ordering and bundle declarations. Documentation describes how step position affects installation.
Pass the language to WordPress boot
packages/playground/client/src/blueprints-v1-handler.ts, packages/playground/client/src/blueprints-v1-handler.spec.ts, packages/playground/cli/src/blueprints-v1/*, packages/playground/remote/src/lib/blueprints-worker.ts, packages/playground/remote/src/lib/playground-worker-endpoint.ts
Client, CLI, and remote worker boot paths pass installationLanguage to WordPress. The CLI uses the release archive for localized installations. The remote worker can skip the database included in a tar.zst bundle.
Prepare and install WordPress in the selected language
packages/playground/wordpress/src/installation-language.ts, packages/playground/wordpress/src/boot.ts, packages/playground/wordpress/src/index.ts, packages/playground/wordpress/src/test/installation-language*.spec.ts
WordPress resolves the requested locale, loads available core translations, and passes the selected language and localized title to the installer when available. Boot can skip a bundled database. Tests cover locale selection, localized starter content, and preservation of existing site content.

Priority: Normal

Estimated code review effort: 3 (Moderate) | ~25 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant BlueprintCompiler
  participant RuntimeConfigurationResolver
  participant BlueprintsV1Handler
  participant bootWordPress
  participant prepareLocalizedInstallation
  participant TranslationCatalog
  participant WordPressInstaller
  BlueprintCompiler->>RuntimeConfigurationResolver: provide compiled installationLanguage
  RuntimeConfigurationResolver->>BlueprintsV1Handler: provide runtime installationLanguage
  BlueprintsV1Handler->>bootWordPress: pass installationLanguage
  bootWordPress->>prepareLocalizedInstallation: prepare locale for a fresh install
  prepareLocalizedInstallation->>TranslationCatalog: fetch locale metadata and translation archive
  prepareLocalizedInstallation->>WordPressInstaller: return selected language and localized title
  WordPressInstaller->>bootWordPress: install WordPress with prepared values
Loading

Possibly related PRs

  • WordPress/wordpress-playground#4505: Implements the normal language: "browser" resolution for the setSiteLanguage step that this PR also uses to select a pre-install language.

Suggested labels: [Type] Documentation, [Package][@wp-playground] Blueprints, [Aspect] Browser

Suggested reviewers: adamziel

Merge Risk: Minimal · up to 44057

The localized installation change is mergeable after normal checks; no concrete unresolved defect is established by the supplied evidence.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "[Blueprints] Localize starter content using an initial setSiteLanguage step" matches the main change. The PR adds an initial setSiteLanguage step that sets the language for a fresh WordPres…
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 15 files. (1 skipped: 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title "[Blueprints] Localize starter content using an initial setSiteLanguage step" matches the main change. The PR adds an initial setSiteLanguage step that sets the language for a fresh WordPress install, which localizes the starter post, page, comment, and category content. The title names the feature, the blueprint area, and the mechanism. It does not cover the CLI cache bypass, the database skip during bundle extraction, or the browser-language selection, but it does not need to.

Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 8 functions across 15 files. (1 skipped: 1 unsupported.)

Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

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

1 participant