WordPressプラグインでは、日付はWordPressがインストールされている言語で表示されます。しかし、サイト上に複数のフィードがあり、それぞれが異なる言語で表示される必要がある場合や、PHPスタンドアロン版を使用している場合など、手動で日付の月を翻訳する必要がある場合があります。その場合は、以下のカスタム JavaScript スニペットを使用します:
$('.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);
});
もし完全な月名を表示するのであれば、"Jan"、"Feb"、"Mar "などを完全な月名に変更する必要がある。
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.