Skip to content

feat(i18n): move to wicket-finance domain and add fr_CA translation #minor - #10

Open
Revenantal wants to merge 8 commits into
mainfrom
feature/translations
Open

Revenantal wants to merge 8 commits into
mainfrom
feature/translations

Conversation

@Revenantal

@Revenantal Revenantal commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Context

Wicket: none
Related PRs: industrialdev/wicket-wp-base-plugin#63, industrialdev/wicket-wp-account-centre#58, industrialdev/wicket-wp-theme#19

What

  • Moves the Finance settings strings from the wicket domain to wicket-finance.
  • Adds languages/wicket-finance.pot and a Canadian French (fr_CA) translation (.po, .mo, .l10n.php) for all 63 strings.
  • Applies the short-string context rule and adds translator context for GL codes and term dates.
  • Adds a pre-commit hook that regenerates the .pot, and a PR check that fails when the .pot is out of date.

Why

Finance strings were on the wrong text domain, several messages were built from separate strings, and order note audit strings were not translatable. Wicket now ships fr_CA, following the Atlas translations convention (conv.stack.translations).

How

Strings

  • The 30 Finance settings strings move to wicket-finance, with context.
  • The five trigger descriptions merge into one string that uses WooCommerce's translated order status labels. The three missing-plugin activation errors merge into one string.
  • Product JS and server-side validation now share the same deferral date messages. Range wording is aligned to "the same as or later than".
  • Order note audit strings are wrapped for translation.
  • Translator comments explain that GL means general ledger and what the term dates cover.
  • Short strings get a context that names their kind. Full sentences drop their contexts.

Tooling

  • The pre-commit hook regenerates languages/wicket-finance.pot. It uses wp on PATH, or downloads a pinned, checksum-verified WP-CLI. It never blocks a commit.
  • composer setup-hooks installs the hook.

Impact on existing translations

Moved 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.

…duplicates

- Move the 30 Finance settings strings from the `wicket` domain to
  `wicket-finance`, with context.
- Merge the five trigger descriptions into one string and use
  WooCommerce's translated order status labels.
- Merge the three missing-plugin activation errors into one string.
- Use the same deferral date messages for product JS and server-side
  validation; align range wording to "the same as or later than".
- Wrap order note audit strings for translation.
- Add a pre-commit hook that regenerates languages/<text-domain>.pot
  from the staged files. It uses `wp` on PATH, or downloads a pinned,
  checksum-verified WP-CLI into the user cache. 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.
- Read extra comma-separated exclude paths from .ci/pot-exclude.
- Leave excluded paths out of the staged snapshot, so large folders
  are not copied.
Explain that GL means general ledger and what the term dates cover, so
translators can render these labels correctly. Msgids are unchanged.
- Add wicket-finance-fr_CA.po covering all 63 strings in wicket-finance.pot,
  with Canadian French terminology and typography.
- Add the compiled .mo and WordPress 6.5+ .l10n.php files.

Site-level translations (Loco, wp-content/languages) still take precedence.
- Give every string of 1 to 3 words a gettext context and drop contexts from
  full sentences, following the Atlas translations convention.
- Contexts name the kind of string (label, button label, status, message,
  accessibility label, ...), not where it shows, so identical strings with the
  same meaning share one translation entry. Specific contexts are kept only
  where the same text has a different meaning (role name, relationship type).
- ACF field strings follow the same rule in the runtime translator and the
  languages/acf-strings.php generator.

Changes msgids' contexts, so existing site translations of these keys stop
matching; accepted because client coverage is under 1% and Wicket ships fr_CA.

@EstebanForge EstebanForge left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved. Smallest of the set and it checks out. What I verified:

  • load_plugin_textdomain already existed in Plugin.php with the right path and stays untouched, so the bundled fr_CA actually loads. The 30 legacy wicket-domain strings are all moved; zero old-domain calls remain. (The , 'error') hits in my sweep were WooCommerce notice types, not textdomains.)
  • msgfmt --check passes on the fr_CA catalog (63 messages), .mo matches, .l10n.php is valid, CI pot check green. Hook and workflow are byte-identical to the base plugin's.
  • The activation errors are deduplicated into one sprintf helper with esc_html, and "Plugin Activation Error" gets a proper context.
  • The audit-note refactor in LineItemMeta keeps the exact same note shape, now with real %1$s/%2$s templates, translators comments, and an empty value placeholder. Nice reuse of WooCommerce's own status labels in the settings screen, with a sane fallback chain.

Thanks Adrian, that closes out the set nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants