Skip to content

Commit

Permalink
adding translations to splide
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-c-woodard committed Dec 11, 2024
1 parent 96c9f04 commit 9035e71
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 1 deletion.
2 changes: 1 addition & 1 deletion includes/assets/js/kb-splide-init.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 20 additions & 0 deletions includes/blocks/class-kadence-blocks-advancedgallery-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,26 @@ public function register_scripts() {
'lightBoxAriaLabel' => __('Display this image in a lightbox', 'kadence-blocks'),
)
);
wp_localize_script(
'kadence-blocks-splide-init',
'kb_splide',
array(
'i18n' => array(
'prev' => __( 'Previous slide', 'kadence-blocks' ),
'next' => __( 'Next slide', 'kadence-blocks' ),
'first' => __( 'Go to first slide', 'kadence-blocks' ),
'last' => __( 'Go to last slide', 'kadence-blocks' ),
'slideX' => __( 'Go to slide %s', 'kadence-blocks' ),
'pageX' => __( 'Go to page %s', 'kadence-blocks' ),
'play' => __( 'Start autoplay', 'kadence-blocks' ),
'pause' => __( 'Pause autoplay', 'kadence-blocks' ),
'carousel' => __( 'carousel', 'kadence-blocks' ),
'slide' => __( 'slide', 'kadence-blocks' ),
'select' => __( 'Select a slide to show', 'kadence-blocks' ),
'slideLabel' => __( '%s of %s', 'kadence-blocks' ),
),
)
);
}
}

Expand Down
20 changes: 20 additions & 0 deletions includes/blocks/class-kadence-blocks-row-layout-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -1711,6 +1711,26 @@ public function register_scripts() {
wp_register_script( 'kad-splide', KADENCE_BLOCKS_URL . 'includes/assets/js/splide.min.js', array(), KADENCE_BLOCKS_VERSION, true );
wp_register_script( 'kadence-blocks-splide-init', KADENCE_BLOCKS_URL . 'includes/assets/js/kb-splide-init.min.js', array( 'kad-splide' ), KADENCE_BLOCKS_VERSION, true );
wp_register_script( 'kadence-blocks-video-bg', KADENCE_BLOCKS_URL . 'includes/assets/js/kb-init-html-bg-video.min.js', array(), KADENCE_BLOCKS_VERSION, true );
wp_localize_script(
'kadence-blocks-splide-init',
'kb_splide',
array(
'i18n' => array(
'prev' => __( 'Previous slide', 'kadence-blocks' ),
'next' => __( 'Next slide', 'kadence-blocks' ),
'first' => __( 'Go to first slide', 'kadence-blocks' ),
'last' => __( 'Go to last slide', 'kadence-blocks' ),
'slideX' => __( 'Go to slide %s', 'kadence-blocks' ),
'pageX' => __( 'Go to page %s', 'kadence-blocks' ),
'play' => __( 'Start autoplay', 'kadence-blocks' ),
'pause' => __( 'Pause autoplay', 'kadence-blocks' ),
'carousel' => __( 'carousel', 'kadence-blocks' ),
'slide' => __( 'slide', 'kadence-blocks' ),
'select' => __( 'Select a slide to show', 'kadence-blocks' ),
'slideLabel' => __( '%s of %s', 'kadence-blocks' ),
),
)
);
}
}

Expand Down
20 changes: 20 additions & 0 deletions includes/blocks/class-kadence-blocks-testimonials-block.php
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,26 @@ public function register_scripts() {
wp_register_style( 'kadence-blocks-splide', KADENCE_BLOCKS_URL . 'includes/assets/css/kb-blocks-splide.min.css', array( 'kadence-kb-splide' ), KADENCE_BLOCKS_VERSION );
wp_register_script( 'kad-splide', KADENCE_BLOCKS_URL . 'includes/assets/js/splide.min.js', array(), KADENCE_BLOCKS_VERSION, true );
wp_register_script( 'kadence-blocks-splide-init', KADENCE_BLOCKS_URL . 'includes/assets/js/kb-splide-init.min.js', array( 'kad-splide' ), KADENCE_BLOCKS_VERSION, true );
wp_localize_script(
'kadence-blocks-splide-init',
'kb_splide',
array(
'i18n' => array(
'prev' => __( 'Previous slide', 'kadence-blocks' ),
'next' => __( 'Next slide', 'kadence-blocks' ),
'first' => __( 'Go to first slide', 'kadence-blocks' ),
'last' => __( 'Go to last slide', 'kadence-blocks' ),
'slideX' => __( 'Go to slide %s', 'kadence-blocks' ),
'pageX' => __( 'Go to page %s', 'kadence-blocks' ),
'play' => __( 'Start autoplay', 'kadence-blocks' ),
'pause' => __( 'Pause autoplay', 'kadence-blocks' ),
'carousel' => __( 'carousel', 'kadence-blocks' ),
'slide' => __( 'slide', 'kadence-blocks' ),
'select' => __( 'Select a slide to show', 'kadence-blocks' ),
'slideLabel' => __( '%s of %s', 'kadence-blocks' ),
),
)
);
}
}

Expand Down
14 changes: 14 additions & 0 deletions src/assets/js/kb-splide-init.js
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,20 @@
prev: 'splide__arrow--prev slick-prev',
next: 'splide__arrow--next slick-next',
},
i18n: {
prev: kb_splide?.i18n?.prev,

Check failure on line 284 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L284

'kb_splide' is not defined (no-undef)
next: kb_splide?.i18n?.next,

Check failure on line 285 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L285

'kb_splide' is not defined (no-undef)
first: kb_splide?.i18n?.first,

Check failure on line 286 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L286

'kb_splide' is not defined (no-undef)
last: kb_splide?.i18n?.last,

Check failure on line 287 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L287

'kb_splide' is not defined (no-undef)
slideX: kb_splide?.i18n?.slideX,

Check failure on line 288 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L288

'kb_splide' is not defined (no-undef)
pageX: kb_splide?.i18n?.pageX,

Check failure on line 289 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L289

'kb_splide' is not defined (no-undef)
play: kb_splide?.i18n?.play,

Check failure on line 290 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L290

'kb_splide' is not defined (no-undef)
pause: kb_splide?.i18n?.pause,

Check failure on line 291 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L291

'kb_splide' is not defined (no-undef)
carousel: kb_splide?.i18n?.carousel,

Check failure on line 292 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L292

'kb_splide' is not defined (no-undef)
slide: kb_splide?.i18n?.slide,

Check failure on line 293 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L293

'kb_splide' is not defined (no-undef)
select: kb_splide?.i18n?.select,

Check failure on line 294 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L294

'kb_splide' is not defined (no-undef)
slideLabel: kb_splide?.i18n?.slideLabel,

Check failure on line 295 in src/assets/js/kb-splide-init.js

View workflow job for this annotation

GitHub Actions / ESLint

src/assets/js/kb-splide-init.js#L295

'kb_splide' is not defined (no-undef)
},
};

if (splideOpts.perPage === 1 || scrollIsOne) {
Expand Down

0 comments on commit 9035e71

Please sign in to comment.