Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
PlugIn > translate Publication date
#5
Hi mvlcek,

I try to use the following:
Code:
$dateLocale = 'de_DE,de,ger,deu';      // or use $LANG or a setting in your plugin,
                                       // for OS compatibility multiple locales should be possible
$dateFormat = "%A, %d.%m.%Y - %H:%M";  // should be a entry in the i18n language file of your plugin
                                       // for the format see PHP function strftime
$oldlocale = setLocale(LC_TIME, '0');  // save old locale
setlocale(LC_TIME, preg_split('/\s*,\s*/', $dateLocale));
echo strftime($dateFormat, $date).'<br />';     // $date is a UNIX timestamp
setLocale(LC_TIME, $oldlocale);        // restore old locale

$Fecha_num="2011-06-15";

setlocale(LC_TIME, preg_split('/\s*,\s*/','es_ES'));
$fecha=strftime('%d %B %Y',strtotime($Fecha_num));
echo $fecha.'<br />';

and show:
Code:
Donnerstag, 01.01.1970 - 01:00
15 June 2011

I don't know why, but it doesn't work in servers that use. Always in english Sad.


Regards.
Reply


Messages In This Thread
PlugIn > translate Publication date - by cumbe - 2010-05-02, 08:37:34
PlugIn > translate Publication date - by luc - 2011-06-15, 21:06:08
PlugIn > translate Publication date - by mvlcek - 2011-06-15, 21:50:12
PlugIn > translate Publication date - by ccagle8 - 2011-06-15, 22:07:32
PlugIn > translate Publication date - by cumbe - 2011-06-16, 03:36:40
PlugIn > translate Publication date - by yojoe - 2011-06-16, 04:04:57
PlugIn > translate Publication date - by mvlcek - 2011-06-16, 04:06:46
PlugIn > translate Publication date - by cumbe - 2011-06-16, 04:32:51
PlugIn > translate Publication date - by yojoe - 2011-06-16, 04:36:36
PlugIn > translate Publication date - by cumbe - 2011-06-16, 04:43:44
PlugIn > translate Publication date - by cumbe - 2011-06-16, 05:05:31
PlugIn > translate Publication date - by mvlcek - 2011-06-16, 05:05:52



Users browsing this thread: 2 Guest(s)