Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <script type="text/javascript">
- (function() {
- // Script to translate English phrases to Spanish in Salsa pages.
- // Function to translate field names in an error block.
- function translateErrors() {
- var error = document.querySelectorAll('.error');
- if (error.length != 0) {
- var phrases = {
- "A credit card number": "Número de Tarjeta",
- Country: "País",
- "A CVV2 code": "Código de seguridad",
- "Please provide a valid Email address[\.]*": "Introduce una dirección de correo electrónico válida",
- Email: "Correo electrónico",
- State: "Estado",
- "is required[\.]*": "requerido"
- }
- Array.from(error).forEach(function(e) {
- var text = e.innerHTML;
- for (var key in phrases) {
- text = text.replace(RegExp(key, "gmi"), phrases[key]);
- }
- e.innerHTML = text;
- });
- }
- }
- // Function to translate donation page phrases.
- function translateDonationFields() {
- $('#donation_pay_periods option').each(function(){
- return $(this).html((function(){
- switch ($(this).val()) {
- case 'MONT': return 'Mensual';
- case 'WEEK': return 'Semanal';
- case 'QTER': return 'Trimestral';
- case 'SMYR': return 'Semestral';
- case 'YEAR': return 'Anual';
- }
- }.call(this)));
- });
- $('option:contains("Unlimited")').html('ilimitado');
- $('label:contains("Recurring contribution")').text('Contribución recurrente');
- $('label:contains("Comments")').text('Comentarios');
- $('label:contains("for")').text('para');
- $("#honorof legend").html("Esta donación es...");
- $('label[for="currency"]').html('Por favor elige una moneda:');
- }
- // Handle a page.
- $(document).ready(function () {
- if (document.location.href.indexOf('/l/spa/') != -1) {
- translateDonationFields();
- translateErrors();
- }
- });
- })();
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement