Closed (fixed)
Project:
Heartbeat
Version:
6.x-4.9
Component:
Code
Priority:
Major
Category:
Task
Assigned:
Reporter:
Created:
14 Aug 2010 at 15:24 UTC
Updated:
2 Sep 2010 at 18:27 UTC
Where can I translate the "time ago" string from the heartbeat settings page "Show the time of action in message displays"? Generally the terms hours/days/time and "ago" seems to be translated (by already translated Drupal strings, I guess) but I cannot find the string from Hearbeat itself. The problem is that it displays: "1 Stunde vor" but in German it should be: "vor 1 Stunde". Can you give me a short hint or should I open a new issue for that?
Comments
Comment #1
design.er commentedThank you for opening this! :)
Comment #2
Stalski commentedThis is fixed in next snapshot, release to 4.10 will come soon.
See http://drupal.org/cvs?commit=408280
Comment #3
Stalski commentedComment #5
mstef commentedI'm having this problem to with a module of my own...
You can translate the "ago" part, but what about 'hours' 'minutes' days' etc??
Comment #6
Stalski commentedHey Mike,
It seems to me that it could be my mistake. format_interval function can take the third argument $langcode. However, when i checked the format_interval, which delegates to format_plural which in his turn delegates to the t function, it is supposed to take the global language as translatable language context. My function to theme the time is like this:
Sidenote: in heartbeat this is fixed to this issue, not in the last stable release i think. So in 10 it will be available.
Now in custom module, it depends ofcourse on how you trigger it.
So within drupal the format_interval would have to translate the units (being year, month, etc ...).
I tested it on the demosite and translated "@count hours" and "@count ago". This is visible in dutch (sorry for that), but proves it should work as long as you use the heartbeat helper function or the format_interval itself.
http://heartbeat.menhireffect.be/nl
Are you helped with this?
Comment #7
mstef commentedThanks, but not really. I know that format_interval takes a langcode but what should be passed?
It's not a big deal. I just made the time format admin-optional. If they need translation, they can use regular time instead. That should work.. (just to remind, this isn't about heartbeat).
Thanks again
Comment #8
Stalski commentedYes, i know it's not about heartbeat ;) that's why i am not reopening this.
But as i see it, as long as you use format_interval without the langcode OR putting the $GLOBALS['language']->language in there manually, it should work. Meaning all parts of the generated time are translatable. Or they should be. I had that problem once in a site too and it happened to be that the global $language was incorrect.
regards
Comment #9
mstef commentedyou'd like format_interval would do that for you...
Comment #10
Stalski commentedI am not sure what you mean by this.
I mean that format_interval does that exactly, without having to pass the language. (well the t-function does, where it's delegating too)