Skip to content

fix(license): correct French promo banner translations - #8572

Open
faisalahammad wants to merge 1 commit into
wp-media:developfrom
faisalahammad:fix/8548-french-translation-promo-banner
Open

fix(license): correct French promo banner translations#8572
faisalahammad wants to merge 1 commit into
wp-media:developfrom
faisalahammad:fix/8548-french-translation-promo-banner

Conversation

@faisalahammad

Copy link
Copy Markdown
Contributor

Summary

Fixed French translation mistakes in dashboard promo banner. The promo name "Anniversary" was not translatable, and several French strings had grammatical errors.

Fixes #8548

Changes

inc/Engine/License/Upgrade.php

Before:

$promo_name = isset( $promo->name ) ? $promo->name : '';

After:

$promo_name = isset( $promo->name ) ? $promo->name : '';
$promo_name = $this->translate_promo_name( $promo_name );

Added translate_promo_name() method that wraps promo names with __() for translation. Currently handles "Anniversary" → "Anniversaire".

Why: Promo names come from API as English strings. Need translation layer for non-English sites.

languages/rocket-fr_FR.po

Before:

"Profitez de %1$s pour accélérez encore plus de sites web : %2$s bénéficiez "
"de %3$s%4$s de réduction sur %5$s pour %3$s mettre à niveau de votre licence"
" vers %6$s ! %5$s"

msgstr "Mettez à niveau maintenant"

After:

"Profitez de %1$s pour accélérer encore plus de sites web : %2$s bénéficiez "
"de %3$s%4$s de réduction%5$s pour %3$smettre à niveau votre licence"
" vers %6$s ! %5$s"

msgstr "Mettre à niveau maintenant"

Also added translation entry:

msgid "Anniversary"
msgstr "Anniversaire"

Why: Fixed 4 translation errors:

  • "accélérez" (imperative) → "accélérer" (infinitive)
  • Removed extra "sur" in "de réduction sur pour"
  • Removed extra "de" in "de votre licence"
  • "Mettez" (imperative) → "Mettre" (infinitive) for button
  • Added space before % in "30 %"
  • Fixed placeholder balancing (two %3$s opens, two %5$s closes)

Testing

Test 1: French promo banner displays correctly

  1. Set WordPress language to French (Français)
  2. Ensure Single license with active promo
  3. Go to WP Rocket dashboard
  4. Verify banner shows: "La promo Anniversaire est en ligne !" and "Profitez de Anniversaire pour accélérer encore plus de sites web : bénéficiez de 30 % de réduction pour mettre à niveau votre licence vers Multi !"
  5. Button shows "Mettre à niveau maintenant"

Result: French translations display correctly with proper grammar.

Test 2: English promo banner unchanged

  1. Switch WordPress language to English
  2. Refresh dashboard
  3. Verify English text displays normally

Result: English translations work as before.

All unit tests pass (10/10), PHPCS clean, PHPStan no errors.

- Translate promo name via translate_promo_name() so 'Anniversary' becomes 'Anniversaire'.
- Fix French wording: accélérez -> accélérer, remove extra 'sur'/'de', and fix CTA button.
- Update DisplayPromoBanner unit test to stub __().

Fixes wp-media#8548
@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 54 complexity

Metric Results
Complexity 54

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

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.

French translation mistakes in dashboard promo notice

1 participant