How to change the text of the Bootstrap Pagination UI pagination buttons?

Asked

Viewed 391 times

3

I’m working with the UI Bootstrap Pagination, but by default the language is in English.

Would it be possible to change without having to modify Javascript directly? If so, could you give me a simple example?

1 answer

2


According to the reply of SOEN, you can configure globally through the object that configures the UI Bootstrap Paginator through the paginationConfig, as below:

angular.module('myapp', ['ui.bootstrap'])

.run(function(paginationConfig){
   paginationConfig.firstText = 'Primeiro';
   paginationConfig.previousText = 'Anterior';

})

In the documentation itself it is also possible to realize that it is possible to make this settings through the attributes passed in uib-pagination.

It’s them:

  • first-text: The text of the button that goes to the first page
  • last-text : the text of the button that goes to the last page
  • previous-text : the text of the back page button
  • next-text : the text of the button that advances a page

Example:

<ul uib-pagination first-text="Primeiro" previous-text="Voltar"></ul>

Just put the desired values to stay in the desired language.

Note: this last way affects only the local configuration. If the desire is to leave the global translation, do through the paginationConfig;

  • 1

    Thanks for the reply! I read the documentation but I must not have understood it properly! Now it’s clear. Vlww

Browser other questions tagged

You are not signed in. Login or sign up in order to post.