Code: Select all
{$entry.timestamp|@formatTime:DATE_FORMAT_SPLIT_ENTRY_DAY|@formatTime:DATE_FORMAT_SPLIT_ENTRY_MONTH|lower|@formatTime:DATE_FORMAT_SPLIT_ENTRY_YEAR}
Code: Select all
{$entry.timestamp|@formatTime:DATE_FORMAT_SPLIT_ENTRY_DAY|@formatTime:DATE_FORMAT_SPLIT_ENTRY_MONTH|lower|@formatTime:DATE_FORMAT_SPLIT_ENTRY_YEAR}
But Понедельник, 7 martxoaren 2011 means Monday, 7 March 2011, you say....LazyBadger wrote:I'll get martxa from Martxa, but I must to have martxoaren
LazyBadger wrote:getting local month's name in correct local form
Yes, lastly I was quite sure to understand.... So, did you solve you modifier question/problem?Timbalu wrote:..., you definitely have to write your own modifier. Did you solve your original question doing this?
No, I can get lowercased months, but nothing around accessing external file (hash-storage)Timbalu wrote: So, did you solve you modifier question/problem?
Missing code of plugin, I write it from the first my post - I have php-code and business logic of smarty-modifier, can't convert it into real, live smarty-modifierTimbalu wrote:What is the trouble with your modifier.localmonth.php?
Code: Select all
<?php
system('locale -a'); // for all locales
//system('locale -a | grep ru'); // for russian locales
?>
Code: Select all
<?php
setlocale (LC_ALL, array ('ru_RU.CP1251', 'rus_RUS.1251'));
?>
Code: Select all
<?php
setlocale (LC_TIME, 'ru_RU.CP1251');
echo strftime ("%A, %e %B %Y");
setlocale (LC_TIME, 'rus_RUS.1251');
echo strftime ("%A, %e %B %Y");
setlocale(LC_TIME, 'ru_RU.UTF-8');
echo strftime ("%A, %e %B %Y");
and so on
ru_RU.CP866
ru_RU.ISO8859-5
ru_RU.KOI8-R
I dont know if there are more to test with...
?>
For all supported Russian locales I got identical resultTimbalu wrote: You could make a testlocale.php with all possible russian locales and test them one by one
Well, it was worth a try.LazyBadger wrote:For all supported Russian locales I got identical result
Code: Select all
...
$cased_month = array (
'Январь' => "января",
'Февраль' => "февраля",
'Март' => "марта",
'Апрель' => "апреля",
'Май' => "мая",
'Июнь' => "июня",
'Июль' => "июля",
'Август' => "августа",
'Сентябрь' => "сентября",
'Октябрь' => "октября",
'Ноябрь' => "ноября",
'Декабрь' => "декабря"
);
...
Code: Select all
...
function serendipity_monthCasing($datestring) {
return strtr($datestring,$cased_month)
}
...
Code: Select all
...
{...|@formatTime:DATE_FORMAT_ENTRY|@monthCasing}
...
Code: Select all
<?php
/**
* Smarty plugin
* @package Smarty
* @subpackage plugins
*/
/**
* Smarty localmonth modifier plugin
*
* Type: modifier
* Name: localmonth
* Purpose: convert date strings month to correct case and lowercase
* @author Ian
* @param string
* @return string
Code:
{$variable|localmonth:"montharray":"rus":true}
*/
function smarty_modifier_localmonth( $monthdate, $newmonth=NULL, $lang="rus", $lower=false )
{
// $monthdate => $variable aus template
// $newmonth => $month array
// $lang => "rus"
if(!is_array($newmonth)) {
$newmonth = array (
'Январь' => "января",
'Февраль' => "февраля",
'Март' => "марта",
'Апрель' => "апреля",
'Май' => "мая",
'Июнь' => "июня",
'Июль' => "июля",
'Август' => "августа",
'Сентябрь' => "сентября",
'Октябрь' => "октября",
'Ноябрь' => "ноября",
'Декабрь' => "декабря" );
}
list($dayname,$day,$month,$year) = explode(' ', $monthdate);
foreach ($newmonth AS $k => $v) {
if($k == $month) { $month = $v; }
}
$string = $dayname . ' ' . $day . ' ' . $month . ' ' . $year;
if($lower) $string = strtolower($string);
return (string)$string;
}
?>
Code: Select all
{$entry.timestamp|@formatTime:DATE_FORMAT_ENTRY|localmonth}
Code: Select all
function smarty_modifier_localmonth( $monthdate='', $lang="rus", $lower=false )
switch($lang) {
case 'rus':
$newmonth = array (.....);
break;
case 'fin':
$newmonth = array (.....);
break;
Code: Select all
$string = strtr($monthdate, $newmonth);
if($lower) $string = strtolower($string);
return (string)$string;