Nel plugin WordPress la data viene visualizzata nella lingua in cui si trova l'installazione di WordPress. A volte, però, si possono avere più feed su un sito e ognuno di essi deve essere in una lingua diversa, oppure si può utilizzare la versione PHP Standalone e quindi è necessario tradurre manualmente i mesi della data. È possibile farlo utilizzando lo snippet JavaScript personalizzato riportato di seguito:
$('.cff-start-date, .cff-end-date').each(function(){
var mapObj = {
Jan:"Translated Jan",
Feb:"Translated Feb",
Mar:"Translated Mar",
Apr:"Translated Apr",
May:"Translated May",
Jun:"Translated Jun",
Jul:"Translated Jul",
Aug:"Translated Aug",
Sep:"Translated Sep",
Oct:"Translated Oct",
Nov:"Translated Nov",
Dec:"Translated Dec"
};
newText = $(this).text().replace(/Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec/gi, function(matched){
return mapObj[matched];
});
$(this).text(newText);
});
Se si visualizzano i nomi completi dei mesi, è necessario cambiare i nomi "Jan", "Feb", "Mar", ecc. con i nomi completi dei mesi: "January", "February", ecc.
Note: In the WordPress plugin you’d need to add the JavaScript to your site using a custom JavaScript plugin. For further information see our documentation here. In the PHP Standalone version you’d need to add it to your website’s JavaScript file, or to the bottom of your page within <script> tags.