i18n
You're browsing the documentation for v3
i18n
Default Texts
Splide allows you to modify all texts used in the slider. It's better to translate them into your language for the sake of accessibility.
Here is the list of default texts:
Key | Text |
---|---|
prev | Previous slide |
next | Next slide |
first | Go to first slide |
last | Go to last slide |
slideX | Go to slide %s |
pageX | Go to page %s |
play | Start autoplay |
pause | Pause autoplay |
Splide will replace the %s
placeholder with a slide index or a page index.
Modifying Texts
To change the default texts, pass an object to the i18n
option,
and Splide merges them into the default collection:
new
Splide
(
'#splide'
,
{
i18n
:
{
prev
:
'Previous slide'
,
next
:
'Next slide'
,
}
}
)
;
JavaScript
new Splide( '#splide', { i18n: { prev: 'Previous slide', next: 'Next slide', } } );
If you have multiple sliders, you can use Splide.defaults
property to set these text at once:
Splide
.
defaults
=
{
i18n
:
{
prev
:
'Previous slide'
,
next
:
'Next slide'
,
}
,
}
;
JavaScript
Splide.defaults = { i18n: { prev: 'Previous slide', next: 'Next slide', }, };
However, it's better to use more content-based texts for accessibility. For example, when viewing a list of articles, "Move to next article" is more appropriate than "Move to next slide".