Help - Search - Members - Calendar
Full Version: French Date format by default is wrong
Movable Type Community Forum > Other Product Discussion > Desired Features
KarlCow
Oooopsss I have forgotten.

In french you don't say for hours smile.gif for example something like

10:30 du matin because the system is 24h

So you have 10:30 and 22:30 and it's not confusing wink.gif
KarlCow
Hi,

I'm using Movable Type 2.0, and found the wonderful feature for the date display.

The problem is that the date format is wrong smile.gif

the display of the date at the begining of an entry have for example the format
Mai 20, 2002
Which is wrong in french, it should be
20 Mai 2002

Another thing which is wrong is the calendar format:

The first day of the week in France is Monday (Lundi) and not  Sunday smile.gif

But except of that you have a wonderful tool

is there a plan to make a french version of the environment too: menu, commands, etc?
smile.gif
btrott
The format of the date in the date header is easy to change, and there isn't really a way for us to do it automatically--you can just edit the format in the <$MTEntryDate$> inside the <MTDateHeader>.

The calendar day of the week is also a bit difficult to do. smile.gif But it is on the todo list.

As for the "du matin": we used to have "du matin", but someone (I don't remember who, it was on the board a while back) said that no one used "du matin"! So we took it out. So I'm afraid you'll have to take it up with that person. smile.gif
CloseGL
Good day!

No problem!  :)

1. In  lib/MT/ConfigMgr.pm adding a new line

$mgr->define('WeekStartsOnMonday', Default => 0);

after

$mgr->define('NoHTMLEntities', Default => 0);

2. In lib/MT/Util.pm file editing line 39 ($days % 7;)

and writing
($days - (MT::ConfigMgr->instance->WeekStartsOnMonday ? 1 : 0)) % 7;

3. In config file (mt.cfg) adding new line

WeekStartsOnMonday 1

4. In Templates move "Sun" to bottom:


5. Report

File "lib/MT/ConfigMgr.pm"
CODE
....
$mgr->define('NoLocking', Default => 0);
$mgr->define('NoHTMLEntities', Default => 0);
$mgr->define('WeekStartsOnMonday', Default => 0);
$mgr->define('NoPlacementCache', Default => 0);
....


File "lib/MT/Util.pm"
CODE
....
$days += $y >> 2;
$days += $In_Year[$leap][$m-1] + $d;
#$days % 7;
($days - (MT::ConfigMgr->instance->WeekStartsOnMonday ? 1 : 0)) % 7;
.....


File "mt.cfg"
CODE
....
# Week Starts On Monday
#  1 - Mon Tue Wen ...
#  0 - Sun Mon Tue ...

WeekStartsOnMonday 1
....


Templates
CODE
<tr>
<th abbr="Monday" align="center"><span class="calendar">Mon</span></th>
<th abbr="Tuesday" align="center"><span class="calendar">Tue</span></th>
<th abbr="Wednesday" align="center"><span class="calendar">Wed</span></th>
<th abbr="Thursday" align="center"><span class="calendar">Thu</span></th>
<th abbr="Friday" align="center"><span class="calendar">Fri</span></th>
<th abbr="Saturday" align="center"><span class="calendar">Sat</span></th>
<th abbr="Sunday" align="center"><span class="calendar">Sun</span></th>
</tr>


Good luck!
Fabien
Hi,

I imperatively need this function. Does the previous solution work? I have not seen any site on the Web with a calendar starting on Monday. Does it exists?

Cheers, Fabien
Carina W-J
My calendar starts on monday with the solution above. My only problem is that the day is wrong. It is one day behind. Anyone know how to solve that?

HereYou can se for Yourself that the above thingy works.
bethlet
The fix recommended by CloseGL not only works for calendars but also for the weekly archive itself. To get this to work with dynamic templates, you'll have to add a line similar to that in step 2 to the file php/lib/MTUtil.php in the wday_from_ts function.

I'm not hugely experienced in Perl so I just hardcoded the -1 instead of checking the configuration.

The line to look for is 124 and my change looked like:

## BCB: 08 Sep 04
# return $days % 7;
return ($days - 1) % 7;
## END

All of my dynamically-generated weekly templates start on a Monday now and end on a Sunday.
Dondo
Thanks ColseGL!
It worked for me too!
lisa
This has changed a little for 3.2:

1) lib/MT/ConfigMgr.pm:

line 78, add:
['WeekStartsOnMonday', { Default => 0 }],


2) lib/MT/Util.pm:

line 59, change:
$days %7;

to:
($days - (MT::ConfigMgr->instance->WeekStartsOnMonday ? 1 : 0)) % 7;

Steps 3 and 4 are still correct. Save your template and rebuild and the calendar should display properly.

Disclaimer: I did not test this with dynamic publishing. Only with static.
Carina W-J
Hi and thanks for the fix for MT 3,2 but, yes there is a but. All the dates then changed. When I have name of day in my entry it writes on day behind, that is for example yesterday was may the 12th and friday. It then writes thursday may the 12th.

I cannot figure out how to get the name of the day correct. Could someone please help me with this.

I am not using dynamic publishing only static and it is MT 3,2
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2010 Invision Power Services, Inc.