Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Advanced Search

hashNSE

Member
  • Content Count

    2
  • Joined

  • Last visited

  1. thank you, this helped me a lot... but something still missing for me: anyone figured how to make this work in to the events too? now the events still shows in english. i tryed this (copied from the comments of one this site http://davidroessli.com/logs/2013/04/squarespace_l10n/ and changed to spanish words) <script> // load a function to replace strings /* * jQuery replaceText - v1.1 - 11/21/2009 * http://benalman.com/projects/jquery-replacetext-plugin/ * Copyright (c) 2009 "Cowboy" Ben Alman * Dual licensed under the MIT and GPL licenses. * http://benalman.com/about/license/ */ (function($){$.fn.replaceText=function(b,a,c){return this.each(function(){var f=this.firstChild,g,e,d=[];if(f){do{if(f.nodeType===3){g=f.nodeValue;e=g.replace(b,a);if(e!==g){if(!c&&/</.test(e)){$(f).before(e);d.push(f)}else{f.nodeValue=e}}}}while(f=f.nextSibling)}d.length&&$(d).remove()})}})(jQuery); </script> <script> var monthDE = []; monthDE[0]="Enero"; monthDE[1]="Febrero"; monthDE[2]="Marzo"; monthDE[3]="Abril"; monthDE[4]="Mayo"; monthDE[5]="Junio"; monthDE[6]="Julio"; monthDE[7]="Agosto"; monthDE[8]="Septiembre"; monthDE[9]="Octubre"; monthDE[10]="Noviembre"; monthDE[11]="Diciembre"; var monthEN = []; monthEN[0]="January"; monthEN[1]="February"; monthEN[2]="March"; monthEN[3]="April"; monthEN[4]="May"; monthEN[5]="June"; monthEN[6]="July"; monthEN[7]="August"; monthEN[8]="September"; monthEN[9]="October"; monthEN[10]="November"; monthEN[11]="December"; var dayDE = []; dayDE[0]="Lunes"; dayDE[1]="Martes"; dayDE[2]="Miercoles"; dayDE[3]="Jueves"; dayDE[4]="Viernes"; dayDE[5]="Sabado"; dayDE[6]="Domingo"; var dayEN = []; dayEN[0]="Monday"; dayEN[1]="Tuesday"; dayEN[2]="Wednesday"; dayEN[3]="Thursday"; dayEN[4]="Friday"; dayEN[5]="Saturday"; dayEN[6]="Sunday"; </script> <script> // replace month $( "time.eventlist-datelabel-startdate" ).each(function() { var label = $( this ).text(); // we now have "March 12" var index = label.indexOf(" "); var detectecMonth = label.substring(0, index); var day = label.substring(index); var translatedMonth = ""; for ( var i = 0; i < 12; i++ ) { if (detectecMonth == monthEN[i]) {translatedMonth = monthDE[i]}; }; $( this ).replaceWith( "<time class='eventlist-datelabel-startdate'>" + day + ". " + translatedMonth + "</time>" ); }); // replace day-month $( "time.event-meta-heading" ).each(function() { var label = $( this ).text(); // we now have "Saturday, March 1, 2014" var index1 =label.indexOf(","); var detectedDay = label.substring(0, index1); var indextemp = label.lastIndexOf(","); var stringtemp = label.substring(index1, indextemp); // we now have ", March 1" indextemp = stringtemp.lastIndexOf(" "); var detectedMonth = stringtemp.substring(2, indextemp); // sometimes there are 2 blanks behind the month, therefore trim detectedMonth = jQuery.trim(detectedMonth); var day = stringtemp.substring(indextemp); var indexyear = label.lastIndexOf(" "); var year = label.substring(indexyear); var translatedDay = ""; var translatedMonth = ""; for ( var i = 0; i < 12; i++ ) { if (detectedMonth == monthEN[i]) {translatedMonth = monthDE[i]}; }; for ( var k = 0; k < 7; k++ ) { if (detectedDay == dayEN[k]) {translatedDay = dayDE[k]}; }; $( this ).replaceWith( "<time class='event-meta-heading'>" + translatedDay + ", " + day + ". " + translatedMonth + year + "</time>" ); }); // translate "(map)" $( "li[class='event-meta-item eventlist-meta-address']" ).each(function() { $('body :not(textarea)').replaceText( "(map)", "(Mapa)" ); }); </script> but still not working for me... Thanks!
×
×
  • Create New...