将日期翻译成西班牙语Wordpress

时间:2016-05-01 16:39:06

标签: php wordpress date

我在Wordpress上有跟随网站,你可以在这里找到不同的英语月份表,我需要把它改成西班牙语:

http://comproautosusados.com/centrolerner2016/horarios/

我尝试了Loco Translate,尝试编辑.pó文件,现在我正在查看主题的php文件。我已经能够翻译很多东西,但我无法翻译这几个月。例如,您可以在表格的左侧看到“Lunes 28th April”。我需要把它改成“Lunes 28 Abril”。

在主题的“核心”中有这个文件:timetable.php,其中找到了这个函数:

public function getDays() {
if (!isset(self::$cache['days'])) {
$days = array();
foreach ($this->get('calendar.period') as $time) {
$object = new VTCore_Wordpress_Objects_Array(array(
'id' => strtolower($time->format('l')),
'timestamp' => $time->getTimeStamp(),
'formatted' => $time->format($this->get('calendar.format')),
'iso' => $time->format('Y-m-d\TH:i:sO'),
'label' => $this->get('days.' . strtolower($time->format('l'))),
));
$days[] = $object;
}
self::$cache['days'] = $days;
}
return self::$cache['days'];
}

主题在哪里生成日期?我不知道该怎么做。

1 个答案:

答案 0 :(得分:0)

我遇到了同样的问题,也许这样的事情可以帮助你:

<?php

// Get the numeric representation of the current month
$m = date('n');

// Get a full textual representation of the month ( in norwegian )
if ($m==1)  { $t = "Januar"; }
if ($m==2)  { $t = "Februar"; }
if ($m==3)  { $t = "Mars"; }
if ($m==4)  { $t = "April"; }
if ($m==5)  { $t = "Mai"; }
if ($m==6)  { $t = "Juni"; }
if ($m==7)  { $t = "Juli"; }
if ($m==8)  { $t = "August"; }
if ($m==9)  { $t = "September"; }
if ($m==10) { $t = "Oktober"; }
if ($m==11) { $t = "November"; }
if ($m==12) { $t = "Desember"; }

// Display the date
echo date('m').".".$t.".".date('Y'); // returns: 05.Mai.2016

?>
相关问题