Jump to content

Localized Date

Featured Replies

Posted

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.

Can you expalin more?

Aren't all the dates already localized as per the setting in the user's user cp?

Yes that's really needed for boards that use another language than english. :)

  • 3 months later...

I would like to ask if there is any progress with this suggestion. Setlocale will be incredibly useful for all non-english boards

In lang_global.php days and months can be translated for the calender. Maybe these entries could also be used.

I thought that the language packs took care of this feature.

Nope, I assumed that too before I started working on a German language pack. But it isn't the case.

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.

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

  • 3 weeks later...

I sent a support ticket about this problem when 2.0customer release was released. I did get answers very quickly, first one said it

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

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


<{POST_SNAPBACK}>



Just open your eyes and look above : hacking the code is the only way to have a full translation.
Localisations are not full and nothing is done to improve it ... except words and words.

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().

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)

Arf, there is a better way (and you should use the strftime() instead, for non english user it's better) which is already used while awaiting for an official issue ...

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.

  • 2 months later...

Localized dates would be considerated for IPB 2.1 ? It's not such a huge change to do compared to other overhauls already done.

  • 3 months later...

This function will be added for IPB 2.1?

  • 1 month later...

This function will be added for IPB 2.1?



Any news for this topic?

I don't remember reading any mention about this feature being in 2.1. It's an issue for me too and I think it should be added. IPS competitors already have it. "That open-source board", for example, has implemented this feature at least three years ago...

I helped someone out with this here before and published my changes that would be needed to the code over at Invisionize. You could try these steps to see if they work for you if this feature doesn't get added sometime soon.

http://forums.invisionize.com/index.php?showtopic=83455

Well I think suggestions are closed for version 2.1 :( :'(

"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.

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...

Archived

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

Recently Browsing 0

  • No registered users viewing this page.