today i found a interesting thing when i was doing to create a localization for weekdays in a dateformat. Until now i thought the smarty developers are much more php-syntax friendly as every other template engine (i mean come on, the smarty 3 concepts are brilliant!), but check this out:
PHP says the week starts on sunday and smarty says the week starts at monday...
Ok that is something i can deal with. no problem at all. But here is the thing.
PHP says the start of the week (sunday) has the key 0 (every coder that had worked with arrays before agree with that), but Smarty says that the first day of a week (monday) has the key 1! o_O
You've got to be kidding me... Come on! Thats the first thing every code newbie lerns in a book. A list starts allways on 0!
So if your work with something like:
$weekdays = array(
0 => 'Sunday',
1 => 'Monday',
...
6 => 'Saturday'
);
be carefull at smarty you might need something like that:
$smarty_weekdays = array(
1 => 'Monday',
2 => 'Tuesday',
...
7 => 'Sunday'
);
strange stuff!
baminc
No comments:
Post a Comment