Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
"plugins": [
"prettier"
],
"env": {
"browser": true
},
"globals": {
"jQuery": true,
"wp": true
Expand Down
17 changes: 17 additions & 0 deletions components/parts/common/swiper-controls.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

/**
* Swiper Controls
* Swiper add/replace automatically the aria-label, the role, the icon on the buttons
*
* @var array $args
*/

?>

<div class="swiper__controls">
<div class="swiper__buttons">
<div class="swiper-button-prev swiper__button" role="button" aria-label="<?php esc_attr_e( 'Previous slide', 'beapi-blocks-theme' ); ?>"></div>
<div class="swiper-button-next swiper__button" role="button" aria-label="<?php esc_attr_e( 'Next slide', 'beapi-blocks-theme' ); ?>"></div>
</div>
</div>
8 changes: 7 additions & 1 deletion inc/Services/Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ public function register_assets(): void {
$this->assets_tools->register_script(
'scripts',
$asset['file'],
array_merge( [ 'jquery' ], $asset['dependencies'] ), // ensure jQuery dependency is set even if not declared explicitly in the JS
array_merge( [ 'jquery', 'wp-i18n' ], $asset['dependencies'] ), // ensure jQuery dependency is set even if not declared explicitly in the JS
$asset['version'],
[ 'strategy' => 'defer' ]
);
Expand Down Expand Up @@ -127,6 +127,12 @@ public function register_assets(): void {
public function enqueue_scripts(): void {
// JS
$this->assets_tools->enqueue_script( 'scripts' );

wp_set_script_translations(
'scripts',
'beapi-blocks-theme',
\get_theme_file_path( 'languages' )
);
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"translation-revision-date":"2026-04-10 16:29+0200","generator":"WP-CLI\/2.12.0","source":"dist\/app.js","domain":"messages","locale_data":{"messages":{"":{"domain":"messages","lang":"fr_FR","plural-forms":"nplurals=2; plural=(n > 1);"},"Previous slide":["Diapositive pr\u00e9c\u00e9dente"],"Next slide":["Diapositive suivante"],"This is the first slide":["C'est la premi\u00e8re diapositive"],"This is the last slide":["C'est la derni\u00e8re diapositive"],"Go to slide {{index}}":["Aller \u00e0 la diapositive {{index}}"],"{{index}} of {{slidesLength}}":["{{index}} sur {{slidesLength}}"]}}}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

JS slider translations miss production file

Medium Severity

The Jed file is hashed from dist/app.js, but production webpack emits app-min.js. wp_set_script_translations looks up JSON by MD5 of the enqueued src, and core only strips a .min.js suffix, not -min.js. In production, __() in Slider.js stays English and Swiper overwrites the PHP-translated control labels with those strings.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit dcf20ed. Configure here.

Binary file modified languages/beapi-blocks-theme-fr_FR.mo
Binary file not shown.
26 changes: 26 additions & 0 deletions languages/beapi-blocks-theme-fr_FR.po
Original file line number Diff line number Diff line change
Expand Up @@ -381,3 +381,29 @@ msgstr ""

#~ msgid "Add to my calendar"
#~ msgstr "Ajouter à mon calendrier"

#: components/parts/common/swiper-controls.php:14
#: dist/app.js
msgid "Previous slide"
msgstr "Diapositive précédente"

#: components/parts/common/swiper-controls.php:15
#: dist/app.js
msgid "Next slide"
msgstr "Diapositive suivante"

#: dist/app.js
msgid "This is the first slide"
msgstr "C'est la première diapositive"

#: dist/app.js
msgid "This is the last slide"
msgstr "C'est la dernière diapositive"

#: dist/app.js
msgid "Go to slide {{index}}"
msgstr "Aller à la diapositive {{index}}"

#: dist/app.js
msgid "{{index}} of {{slidesLength}}"
msgstr "{{index}} sur {{slidesLength}}"
26 changes: 26 additions & 0 deletions languages/beapi-blocks-theme.pot
Original file line number Diff line number Diff line change
Expand Up @@ -336,3 +336,29 @@ msgstr ""
msgctxt "Template part name"
msgid "Footer"
msgstr ""

#: components/parts/common/swiper-controls.php:14
#: dist/app.js
msgid "Previous slide"
msgstr ""

#: components/parts/common/swiper-controls.php:15
#: dist/app.js
msgid "Next slide"
msgstr ""

#: dist/app.js
msgid "This is the first slide"
msgstr ""

#: dist/app.js
msgid "This is the last slide"
msgstr ""

#: dist/app.js
msgid "Go to slide {{index}}"
msgstr ""

#: dist/app.js
msgid "{{index}} of {{slidesLength}}"
msgstr ""
Loading