Repository navigation
feat(i18n): move to wicket-base text domain and add fr_CA translation #minor - #63
Revenantal wants to merge 3 commits into
Conversation
- Add the shared pre-commit hook that regenerates languages/<text-domain>.pot from the staged files. It never blocks a commit. - Make `composer setup-hooks` install the pre-commit hook. - Add a PR check that fails when the committed .pot is out of date.
- Change the text domain from the shared `wicket` to `wicket-base`.
WicketWP\Language loads languages/ and falls back to `wicket` when a string
has no `wicket-base` translation, so existing Loco/WPML translations apply.
- Move strings off foreign domains (wicket-child, sassquatch,
woocommerce-memberships-teams, woocommerce-memberships, and WooCommerce
strings WooCommerce does not have). Give domainless strings wicket-base.
Real WooCommerce and Event Tickets Plus strings keep their domains.
- Apply the short-string context rule (contexts name the kind of string).
- Account widgets: build error lines with WicketWP\Widgets\FormErrors from
whole strings ("%1$s: %2$s", "Error: %d") and escape the output instead of
gluing field names to messages. Use sentence case for field names.
- Replace fragments with whole strings: "Go back to %s", "Related %s",
"Tab %d", "Can't find your %s?", "Name of the %s", "Type of %s", and the
org search placeholder that was concatenated inside _e().
- Add translator comments to all placeholder strings; use real plurals.
- Fix English typos (display, subscription, account, required, WordPress, API,
"Log in to Purchase Ticket") and a broken <em> tag.
- Add languages/wicket-base.pot.
Existing translations of changed or re-contexted strings stop matching;
accepted because client coverage is under 1% and Wicket ships fr_CA.
- Add wicket-base-fr_CA.po covering all 369 strings in wicket-base.pot, with Canadian French terminology and typography. Terms shared with the Account Centre, theme, and financial fields reuse their translations. - Add the compiled .mo and WordPress 6.5+ .l10n.php files. Site-level translations (Loco, wp-content/languages) still take precedence.
EstebanForge
left a comment
There was a problem hiding this comment.
Approved. The migration itself checks out.
Two items I'd fix in a follow-up (neither blocks the merge):
-
includes/components/org-search-select.php:974still calls_e('Search for your', 'wicket'). It's the only string left on the old domain. It never lands inwicket-base.pot, so the CI drift check and Loco can't see it. Please move it to_x('Search for your', 'label', 'wicket-base'). -
The
FormErrors::field_message()docblock says API error titles get looked up in the plugin domain. The actual call is a context-freetranslate($message, 'wicket-base'), and catalog entries like "can't be blank" live undermsgctxt "message", so that lookup can never match and those titles stay English. Same behavior as the old code, so no regression, but other packages will copy this class. Please fix the lookup or the comment.
Thanks Adrian, nice work on the fallback design :)
Context
Wicket: none
Related PRs: industrialdev/wicket-wp-account-centre#58, industrialdev/wicket-wp-theme#19, industrialdev/wicket-wp-financial-fields#10
What
wickettext domain towicket-base. If a string has nowicket-basetranslation, it falls back towicket.languages/wicket-base.potand a Canadian French (fr_CA) translation (.po,.mo,.l10n.php) for all 369 strings..pot, and a PR check that fails when the.potis out of date.Why
Base strings were spread across foreign domains (
wicket-child,sassquatch,woocommerce-memberships*, and others), had no context, and were often built from fragments. That made them hard or impossible to translate. Wicket now ships fr_CA, following the Atlas translations convention (conv.stack.translations).How
Text domain
WicketWP\Languageloadslanguages/and falls back to thewicketdomain, so existing Loco/WPML translations still apply.wicket-base. Real WooCommerce and Event Tickets Plus strings keep their own domains.String cleanup
WicketWP\Widgets\FormErrorsand the output is escaped.<em>tag.Tooling
composer setup-hooksinstalls the pre-commit.pothook. The hook never blocks a commit.Impact on existing translations
Changed or re-contexted strings no longer match existing site translations. We accepted this because client translation coverage is under 1% and fr_CA now ships with the plugin. Site-level translations (Loco,
wp-content/languages) still take precedence.