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

Add i18n infrastructure for Playground web app #2113

Draft
wants to merge 7 commits into
base: trunk
Choose a base branch
from

Conversation

brandonpayton
Copy link
Member

@brandonpayton brandonpayton commented Dec 31, 2024

Motivation for the change, related issues

We want to make translations possible for the Playground web app.

Implementation details

This PR:

  • Adds a small function for extracting WP-i18n-style gettext strings for translation
  • Adds an nx executor for generating a POT file from a codebase
  • Adds an i18n module to the Playground website package that exports @wordpress/i18n functions configured to use the "wordpress-playground-website" text domain.
  • Makes some introductory conversion of hard-coded strings to use the i18n API, and adds a packages/playground/website/website.pot file to demonstrate their extraction.

Remaining work

  • Confirm strings for _n(), _x(), and _nx()` are extracted properly.
  • Dynamically load website translation for declared language when available

Testing Instructions (or ideally a Blueprint)

  • CI
  • Smoke test with npm run dev
  • Manually run npx nx extract-i18n-strings playground-website and confirm that packages/playground/website/website.pot contains the expected strings.

@brandonpayton
Copy link
Member Author

Hi @amieiro, this PR adds some infrastructure to start making the Playground web app translatable. How does this look to you? Specifically, does the website.pot file look normal to you?

What would be a good way for us to make the .pot file available to you? Would it be enough to commit updates to the GitHub repo?

Do you have any other thoughts or suggestions for this work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Inbox
Development

Successfully merging this pull request may close these issues.

1 participant