Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.89 KB | None | 0 0
  1. <script type="text/javascript">
  2. (function() {
  3. // Script to translate English phrases to Spanish in Salsa pages.
  4.  
  5. // Function to translate field names in an error block.
  6. function translateErrors() {
  7. var error = document.querySelectorAll('.error');
  8. if (error.length != 0) {
  9. var phrases = {
  10. "A credit card number": "Número de Tarjeta",
  11. Country: "País",
  12. "A CVV2 code": "Código de seguridad",
  13. "Please provide a valid Email address[\.]*": "Introduce una dirección de correo electrónico válida",
  14. Email: "Correo electrónico",
  15. State: "Estado",
  16. "is required[\.]*": "requerido"
  17. }
  18. Array.from(error).forEach(function(e) {
  19. var text = e.innerHTML;
  20. for (var key in phrases) {
  21. text = text.replace(RegExp(key, "gmi"), phrases[key]);
  22. }
  23. e.innerHTML = text;
  24. });
  25. }
  26. }
  27.  
  28. // Function to translate donation page phrases.
  29. function translateDonationFields() {
  30. $('#donation_pay_periods option').each(function(){
  31. return $(this).html((function(){
  32. switch ($(this).val()) {
  33. case 'MONT': return 'Mensual';
  34. case 'WEEK': return 'Semanal';
  35. case 'QTER': return 'Trimestral';
  36. case 'SMYR': return 'Semestral';
  37. case 'YEAR': return 'Anual';
  38. }
  39. }.call(this)));
  40. });
  41. $('option:contains("Unlimited")').html('ilimitado');
  42. $('label:contains("Recurring contribution")').text('Contribución recurrente');
  43. $('label:contains("Comments")').text('Comentarios');
  44. $('label:contains("for")').text('para');
  45. $("#honorof legend").html("Esta donación es...");
  46. $('label[for="currency"]').html('Por favor elige una moneda:');
  47. }
  48.  
  49. // Handle a page.
  50. $(document).ready(function () {
  51. if (document.location.href.indexOf('/l/spa/') != -1) {
  52. translateDonationFields();
  53. translateErrors();
  54. }
  55. });
  56. })();
  57. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement