Jump to content

Localized Date


Guest thewiseoldman

Recommended Posts

Guest thewiseoldman

Please add this feature, with the possibility to edit the locale via the ACP, using setlocale.

At worst if the locale is not installed on the server, the date will remain in english.

Link to comment
Share on other sites

  • 3 months later...

Nope, language pack do this for calendar or other tweaks.
The date in topics is based upon the gmdate() function (derived from date()) but it is english-only, whatever your setlocale() is.

If i want to display the time in the correct language, we need to edit some files to modify functions and some other things ... each time, it's verry annoying, especially if we think that the strftime() (localized time display) was in use in IPB 1.3 (or just before, in the 1.2).

As language packs option is available, it's a bit curious not to do it right to the end.

Link to comment
Share on other sites

Guest thewiseoldman

This suggestion has been approuved long time ago I don't know why it is not in the code yet :'( Maybe customers not speaking english are not so important for IPS...

gmdate is used for long, I changed it to gmstrftime to localize the date within the french version of IPB 1.1.2

Link to comment
Share on other sites

  • 3 weeks later...
Guest thewiseoldman

should be possible with 'hacking' the code...


<{POST_SNAPBACK}>



It is possible and really easy to add, there are at least two ways, via language pack or via setlocale().
Link to comment
Share on other sites

Becouse it seems that we wont get any answer from Invision team, here is a small diff:
--- functions.php.org 2005-02-05 01:01:55.781250000 +0100
+++ functions.php 2005-02-05 01:08:29.296875000 +0100
@@ -1838,15 +1838,35 @@
}
else
{
- return gmdate($this->time_options[$method], ($date + $this->offset) );
+ $date = gmdate($this->time_options[$method], ($date + $this->offset) );
+ return $this->translate_date($date);
}
}
else
{
- return gmdate($this->time_options[$method], ($date + $this->offset) );
+ $date = gmdate($this->time_options[$method], ($date + $this->offset) );
+ return ($method == 'LONG') ? $date : $this->translate_date($date);
}
}
-
+function translate_date($date)
+ {
+ global $ibforums;
+ $eng_long_months = array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December');
+ for($i = 1; $i <= 12; $i++) $local_long_months[] = $ibforums->lang["M_$i"];
+ $date = str_replace($eng_long_months, $local_long_months, $date);
+ $eng_short_months = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec');
+ for($i = 1; $i <= 12; $i++) $local_short_months[] = substr($ibforums->lang["M_$i"], 0, 3);
+ $date = str_replace($eng_short_months, $local_short_months, $date);
+
+ $eng_long_days = array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday');
+ for($i = 0; $i <= 6; $i++) $local_long_days[] = $ibforums->lang["D_$i"];
+ $date = str_replace($eng_long_days, $local_long_days, $date);
+ $eng_short_days = array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
+ for($i = 0; $i <= 6; $i++) $local_short_days[] = substr($ibforums->lang["D_$i"], 0, 3);
+ $date = str_replace($eng_short_days, $local_short_days, $date);
+ return $date;
+ }
+
/*-------------------------------------------------------------------------*/
// Returns the time - tick tock, etc
/*-------------------------------------------------------------------------*/

It shoud be applied on sources/functions.php
It's not a very clean solution but it works.
After appying the path you should change date format in acp to something similar to:
j F Y - H:i instead of jS F Y - h:i A.
(S - adds "nd" "st" and so on ; H instead of h to 24h format)

Link to comment
Share on other sites

IPB has already some good features concerning languages.
But there is still some work to do: e.g. date and custom profile fields
on registration form and topic view.

For our customers improvements in these fields would be a necessary condition
for buying IPB. ;)

I'm looking forward to seeing further action from IPB developpers soon.

Link to comment
Share on other sites

  • 2 months later...
  • 3 months later...
  • 1 month later...

"That open-source board", for example, has implemented this feature at least three years ago...



It's hardly a very nice user friendly implementation though is it - having an administrator managed list which users can select from would be much more user friendly IMHO.
Link to comment
Share on other sites

marcoos: Thanks, I'll try that out! ^_^

It's hardly a very nice user friendly implementation though is it [...]


The only thing you need to do is translate the strings in the language file. Friendly enough, if you ask me. IPB already have this information on lang_global.php. As marcoos' post shows, it's just a matter of replacing the names and you're done.

[...] having an administrator managed list which users can select from would be much more user friendly IMHO.


Sorry, could you explain this further? I didn't understand your suggestion...
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...