Skip to main content
Topic: [RC1] time format with "today" and "yesterday" (Read 5360 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

[RC1] time format with "today" and "yesterday"

I choose the german language files. If I choose to use "today" and "yesterday", the time stamp on these two days will look like this:

18:45

On the other days it will look like this:

18:45 Uhr

Is there any chance to fix this?

Re: [RC1] time format with "today" and "yesterday"

Reply #1
Looks good on my "test install"... except I don't know German and I rely on google... O:-)

Where does it look like that?
Bugs creator.
Features destroyer.
Template killer.

Re: [RC1] time format with "today" and "yesterday"

Reply #2
In forum index. With german language we need the "Uhr" every time.

Edit: "Am Heute um 16:45" too is not perfect. It should be "Heute um 16:45 Uhr". But that's nearly impossible to handle, right?

Re: [RC1] time format with "today" and "yesterday"

Reply #3
hmm...
Okay, without having realized it, that's exactly the problem I was thinking about yesterday while looking at the code.
The current strings are:
Code: [Select]
$txt['today'] = 'Today';
and used like:
Code: [Select]
$txt['today'] . $time
while it would be much better to have:
Code: [Select]
$txt['today'] = 'Today %1$s';
and use them like:
Code: [Select]
sprintf($txt['today'], $time)
that way in German it would become:
Code: [Select]
$txt['today'] = 'Heute um %1$s Uhr'];

That said, could you please have a look here:
http://www.elkarte.it/community/index.php?language=german
because it seems to me there is something different from your screen (the "vormittags"). Not sure how to relate it with the rest... :-[
The whole sentence is:
Quote
am Heute um 09:15:11 vormittags
Bugs creator.
Features destroyer.
Template killer.

Re: [RC1] time format with "today" and "yesterday"

Reply #4
...it would be much better to have:

Code: [Select]
$txt['today'] = 'Today %1$s';
and use them like:

Code: [Select]
sprintf($txt['today'], $time)
that way in German it would become:

Code: [Select]
$txt['today'] = 'Heute um %1$s Uhr'];

That said, could you please have a look here:
http://www.elkarte.it/community/index.php?language=german
because it seems to me there is something different from your screen (the "vormittags"). Not sure how to relate it with the rest... :-[
The whole sentence is:

Quote
am Heute um 09:15:11 vormittags

Much better. It would be perfect if it were like this:

am Heute um 09:15 Uhr vormittags  O:-)

"Vormittags" is only needed with 12h instead of 24h. Or without any hour. It's nearly the same as "am" (vormittags) and "pm" (nachmittags).

Re: [RC1] time format with "today" and "yesterday"

Reply #5
Oh so the "am" there is not German but the English "am"?
Bugs creator.
Features destroyer.
Template killer.

Re: [RC1] time format with "today" and "yesterday"

Reply #6
Right. You can use one of these in german, they are all correct:

Heute vormittag um 9:45 Uhr. (which means today 9:45 am)
Gestern nachmittag um 17:45 Uhr. (which means yesterday 5:45 pm)
Heute um 9:45 Uhr.
Heute vormittag. (without time and s)
Gestern nachmittag. (without time and s)
Am 27.09. vormittags um 9:45 Uhr. (with time and s)
Am 27.09. nachmittags um 17:45 Uhr. (with time and s)
Am 27.09. um 9:45 Uhr.

Re: [RC1] time format with "today" and "yesterday"

Reply #7
Thanks for the explanation! :D

 emanuele keeps this unread
Bugs creator.
Features destroyer.
Template killer.

Re: [RC1] time format with "today" and "yesterday"

Reply #8
You're welcome.

Re: [RC1] time format with "today" and "yesterday"

Reply #9
By the way: The "who's online" site is missing the "Uhr" after the time completely.  O:-)

Re: [RC1] time format with "today" and "yesterday"

Reply #10
Right. You can use one of these in german, they are all correct:

Heute vormittag um 9:45 Uhr. (which means today 9:45 am)
Gestern nachmittag um 17:45 Uhr. (which means yesterday 5:45 pm)
Heute um 9:45 Uhr.
Heute vormittag. (without time and s)
Gestern nachmittag. (without time and s)
Am 27.09. vormittags um 9:45 Uhr. (with time and s)
Am 27.09. nachmittags um 17:45 Uhr. (with time and s)
Am 27.09. um 9:45 Uhr.
Will this "problem" be fixed in RC2 or final? O:-)

Re: [RC1] time format with "today" and "yesterday"

Reply #11
That one may be a bit tricky.
The main problem is that these strings are used in a kind of odd way in the "who is online" page too, and just replace them with an sprintf would create problems there.
In particular, in http://www.elkarte.net/community/index.php?action=who the "time" column is built like that:
* 1st the normal time is generated doing:
Code: [Select]
$time = $txt['today'] . $time
and obtaining "Today at 02:46:17 pm" for example,
* then, somewhere else, the "today at" is stripped out with a replace like this:
Code: [Select]
$time = strtr($time, array($txt['today'] => ''));

To solve that it requires to add two new strings in Who.{language}.php at least.

Let's see, try to apply these changes and see if the result looks good, then we can decide on applying it to RC2 or final.

In Subs.php:
Code: (find) [Select]
			return $txt['today'] . standardTime($log_time, $today_fmt, $offset_type);
Code: (replace with) [Select]
			return sprintf($txt['today'], standardTime($log_time, $today_fmt, $offset_type));

then:
Code: (find) [Select]
			return $txt['yesterday'] . standardTime($log_time, $today_fmt, $offset_type);
Code: (replace with) [Select]
			return sprintf($txt['yesterday'], standardTime($log_time, $today_fmt, $offset_type));

In index.english.php:
Code: (find) [Select]
$txt['today'] = 'Today at ';
$txt['yesterday'] = 'Yesterday at ';
Code: (replace with) [Select]
$txt['today'] = 'Today at %1$s';
$txt['yesterday'] = 'Yesterday at %1$s';
And the corresponding change in index.german.php.
Additionally, in Who.english.php and Who.german.php:
Code: (add at the end) [Select]
// Overrides the already defined strings to get clean results in the table
$txt['today'] = '%1$s';
$txt['yesterday'] = '%1$s';

Let me know if it works for you. ;)
Bugs creator.
Features destroyer.
Template killer.

Re: [RC1] time format with "today" and "yesterday"

Reply #12
Still have a "am Heute um 09:12"  :(

Re: [RC1] time format with "today" and "yesterday"

Reply #13
What did you put in $txt['today'] and $txt['yesterday'] of the index.german.php file?
Bugs creator.
Features destroyer.
Template killer.

Re: [RC1] time format with "today" and "yesterday"

Reply #14
Code: [Select]
// Overrides the already defined strings to get clean results in the table

$txt['today'] = '%1$s';
$txt['yesterday'] = '%1$s';
Ah... There must be "Heute" und "Gestern" instead of "%1$s"? No... Now it's "Am Heute um" without any time.