Skip to content
This repository has been archived by the owner on Jan 7, 2021. It is now read-only.

Commit

Permalink
Merge pull request #41 from locaweb/fix_select2_i18n
Browse files Browse the repository at this point in the history
Fix select2 i18n
  • Loading branch information
deividmarques committed Jun 11, 2015
2 parents 1a2be4c + 82b31a8 commit 0c95274
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions source/assets/javascripts/libs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//= require libs/_jquery
//= require libs/_modernizr
//= require libs/_select2.min
//= require libs/_select2_locale_pt-BR
//= require libs/_jquery-ui.min
//= require libs/_masked-input
//= require libs/_cookie
18 changes: 18 additions & 0 deletions source/assets/javascripts/libs/_select2_locale_pt-BR.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/**
* Select2 Brazilian Portuguese translation
*/
(function ($) {
"use strict";

$.fn.select2.locales['pt-BR'] = {
formatNoMatches: function () { return "Nenhum resultado encontrado"; },
formatAjaxError: function () { return "Erro na busca"; },
formatInputTooShort: function (input, min) { var n = min - input.length; return "Digite " + (min == 1 ? "" : "mais") + " " + n + " caracter" + (n == 1? "" : "es"); },
formatInputTooLong: function (input, max) { var n = input.length - max; return "Apague " + n + " caracter" + (n == 1? "" : "es"); },
formatSelectionTooBig: function (limit) { return "Só é possível selecionar " + limit + " elemento" + (limit == 1 ? "" : "s"); },
formatLoadMore: function (pageNumber) { return "Carregando mais resultados…"; },
formatSearching: function () { return "Buscando…"; }
};

$.extend($.fn.select2.defaults, $.fn.select2.locales['pt-BR']);
})(jQuery);
4 changes: 3 additions & 1 deletion source/assets/javascripts/locastyle/_locastyle.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,9 @@ Locastyle = (function() {
},

initCustomSelect: function(dom_scope){
$("select.customSelect", dom_scope).select2();
$("select.customSelect", dom_scope).select2({
language: 'pt-BR'
});
},

notificationInfoSet: function(dom_scope){
Expand Down
4 changes: 2 additions & 2 deletions source/manual/formularios/selects.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ menu_page: sidebar-formularios.erb
<h3>Padrões e funções de selects customizados.</h3>
</header>

<p>Na Locaweb utilizamos o <a href="http://harvesthq.github.com/chosen/">Chosen</a> para customizar nossos selects. Ele é o plugin mais completo e acessível que encontramos.</p>
<p>Utilizamos o <a href="http://select2.github.io/select2/">Select2</a> para customizar nossos selects. Ele é o plugin mais completo e acessível que encontramos.</p>

<p>Para utilizá-lo é simples, basta usar a classe <strong>customSelect</strong> no select que você quer customizar e pronto.</p>

Expand Down Expand Up @@ -139,4 +139,4 @@ menu_page: sidebar-formularios.erb
&lt;/optgroup&gt;
&lt;/select&gt;
</pre>
</article>
</article>

0 comments on commit 0c95274

Please sign in to comment.