-
New Feature
-
Resolution: Won't Do
-
Minor
-
None
-
1.9.4
-
None
-
All
-
MOODLE_19_STABLE
I'm offering add function which will get months' and days' names (and their acronym) from lang files. Because locale often include words in incorrect form.
For example in russian:
We speak 2'nd of September as [vtoroe sentiabria] but just [sentiabr] if we mean name of month. But in locale %B correspond to [sentiabria] and it looks not well.
It will necessary to add monthes and acronyms to calendar.php
function strftime_ex($format, $date, $fixday = true) {
global $CFG;
static $strftimedaydatetime;
if ($format == '') {
if (empty($strftimedaydatetime))
{ $strftimedaydatetime = get_string('strftimedaydatetime'); }$format = $strftimedaydatetime;
}
/// correcting dates (dlnsk) %%62%%
$str = get_string(strtolower(date('F', $date)), 'calendar'); // January
$format = str_replace('%B', $str, $format);
$str = get_string(strtolower(date('l', $date)), 'calendar'); // Monday
$format = str_replace('%A', $str, $format);
$str = get_string(strtolower(date('M', $date)), 'calendar'); // Jan
$format = str_replace('%b', $str, $format);
$str = get_string(strtolower(date('D', $date)), 'calendar'); // Mon
$format = str_replace('%a', $str, $format);
if (!empty($CFG->nofixday))
{ // Config.php can force %d not to be fixed. $fixday = false; }else if ($fixday)
{ $formatnoday = str_replace('%d', 'DD', $format); $fixday = ($formatnoday != $format); }if ($fixday)
{ $datestring = strftime($formatnoday, $date); $daystring = str_replace(' 0', '', strftime(' %d', $date)); $datestring = str_replace('DD', $daystring, $datestring); }else
{ $datestring = strftime($format, $date); }return $datestring;
}