feat: add full i18n support and ship .pot translation template (v3.15.0)#103
Merged
Conversation
- Wrap all ~55 user-facing strings in i18n functions across 7 PHP files - Use esc_html__() for WP_List_Table columns/bulk actions (not escaped by WP core) - Use esc_html__() for menu titles (WordPress doesn't guarantee escaping) - Use wp_kses_post(__()) for description text containing <b> formatting - Use _n() for proper plural form in prune log row count message - Ship languages/custom-404-pro.pot (78 msgid entries) generated via wp i18n make-pot - Add composer makepot script for regenerating the template - Add validate-translations CI job: msgfmt --check-format + XSS pattern grep on msgstr lines - Add Contributing Translations section to README.md - Bump version to 3.15.0
…elines Lead with translate.wordpress.org as the primary channel (web UI, no setup required, translations auto-packaged at 90% completion). Frame the GitHub PR path as the secondary route for developers who want to contribute .po/.mo files directly. Add `npx wp-env start` as a required prerequisite before `composer makepot` so contributors aren't hit with a cryptic Docker connection error.
e703e53 to
d6c238d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
languages/custom-404-pro.pot(78msgidentries) generated viawp i18n make-pot— this is the template community translators copy to create.pofiles for their localevalidate-translationsCI job that runsmsgfmt --check-formatand a grep-based XSS scan on any contributed.pofiles (no-ops cleanly until a translation PR lands)composer makepotscript for regenerating the template after string changesREADME.mddocumenting the workflow for contributorsSecurity
i18n introduces a new attack surface — a translator could embed HTML/JS in a translated string. All output contexts are guarded:
esc_html_e()/esc_html( sprintf( __() ) )esc_attr__()/esc_attr_e()<b>tagswp_kses_post( __() )esc_html__()— WP does not escape theseesc_html__()— WP does not escape theseesc_html__()— WP doesn't guarantee escapingwp_mail)__()raw — not output to browser__()raw —custom_404_pro_notices()appliesesc_html()at display timeThe CI
validate-translationsjob adds a second layer:msgfmt --check-formatblocks format specifier mismatches (prevents runtimesprintf()errors) and a grep scan blocks<script,javascript:,onerror=,<iframe, andeval(inmsgstrlines.Test plan
composer lint) — 15/15 files cleancomposer test) — 36/36 tests pass.potfile contains 78msgidentries covering all wrapped stringsvalidate-translationsCI job no-ops cleanly (no.pofiles yet)composer test:integration)