IRC logs for #farmOS, 2020-06-08 (GMT)

2020-06-07
2020-06-09
TimeNickMessage
[04:03:44]* JustTB has quit (Quit: Leaving.)
[04:37:14]* JustTB has joined #farmos
[05:04:45]<skipper_is[m]>Yea, the one thing is that it doesnt' take into account the time zone formatting of the region. So for most of the world, dd/mm/yyyy, but for the US.... Well, you know what you've done USA....
[05:07:30]<skipper_is[m]>It would be nice to have it on the main page, but it would require calling all logs with weight to filter out the last 2, rather than the current function that just gets the latest. I'm just wondering whether that'd negativly impact load times much
[08:15:00]<skipper_is[m]>Ooh, does date() use the local timezone formatting of the server?
[08:18:10]<mstenta[m]>skipper_is: yea I think `date()` will use the timezone from the server/user
[08:18:19]<mstenta[m]>it takes a UNIX timestamp, which is always UTC
[08:19:15]<mstenta[m]>and then within PHP there are a few levels of "timezone"... system level (the server itself), site (the site-wide Drupal default timezone), user (each Drupal user can set their own timezone, which overrides the site-wide one)
[08:20:23]<mstenta[m]>err... actually maybe `date()` doesn't have knowledge of the Drupal level stuff
[08:20:31]<mstenta[m]>but `format_date()` would
[08:20:34]<mstenta[m]>https://api.drupal.org/api/drupal/includes%21common.inc/function/format_...
[08:23:57]<skipper_is[m]>Yea, but format_dates formats are with the time, and I'm just after the date.. even format short
[08:24:12]<mstenta[m]>ah you can use `custom` to change that
[08:24:52]<mstenta[m]>`format_date($timestamp, $type = 'custom', $format = 'd/m/Y');`
[08:25:09]<skipper_is[m]><mstenta[m] "but `format_date()` would"> But is it then respecting the m/d/y that the US insists on using?
[08:25:35]<skipper_is[m]>Because I could achieve that effect with date()
[08:25:38]<mstenta[m]>Hmm yea this is a bigger question :-)
[08:25:57]<skipper_is[m]>At least with date() it'll follow the server formatting
[08:26:05]<mstenta[m]>Probably something we want to address at a system-wide level somehow in farmOS
[08:26:15]<skipper_is[m]>Drupal wide I think...
[08:26:20]<mstenta[m]>Yes
[08:26:28]<skipper_is[m]>A short format_date that only does date
[08:26:41]<mstenta[m]>And Drupal DOES have some support for this already... I just don't have much experience modifying it
[08:26:53]<mstenta[m]>Ah gotcha (sorry still catching up here, and waking up ha)
[08:27:17]<mstenta[m]>Yea, I've wanted that in the past too... a short format without time
[08:30:54]<skipper_is[m]>I'll stick with date() at the moment, so it can take it from server php settings
[08:32:24]<skipper_is[m]>But I've made a new livestock_weight function that gets all records with weights, and another that takes the most recent 2 records and calculates the daily liveweight gain
[08:33:37]<skipper_is[m]>I might refactor the individual weight report page to use that function as well
[08:33:49]<mstenta[m]>Coool!
[08:35:03]<skipper_is[m]>The function is just a modification on the lines that call all weight records in the individual report, but pulled into its own function so I can reuse the code
[09:03:02]* jgaehring[m] has joined #farmos
[09:53:17]<skipper_is[m]>Well, it mostly works. Wording wise, I'm not so sure
[09:53:35]<skipper_is[m]>Also, does the output get t() before it rendered?
[09:54:49]<skipper_is[m]>..And it is refusing to allow me to upload images...
[09:56:35]<skipper_is[m]>It's a race of PC against phone..
[09:57:22]<skipper_is[m]>Both have lost... Error 520 from riot!
[09:57:44]<skipper_is[m]>https://pasteboard.co/Jc8Xhtp.png
[09:57:45]<skipper_is[m]>There we go
[09:58:06]<mstenta[m]>oh very cool!!!
[09:58:29]<skipper_is[m]>The load time of the get_all function vs without was the same
[09:58:58]<mstenta[m]>re: `t()` i think the only thing that should be translatable is the "Daily Liveweight Gain since" portion
[09:58:58]<skipper_is[m]>I'll refactor the individual weight report page to use that function, and push it
[09:59:34]<mstenta[m]>There's a good overview of using the `t()` function with placeholders here: https://api.drupal.org/api/drupal/includes%21bootstrap.inc/function/t/7.x
[10:00:23]<skipper_is[m]>The existing weights pages aren't translated
[10:00:50]<skipper_is[m]>So I assumed the whole output went through translate, but maybe not
[10:02:47]<mstenta[m]>ah ok that might be an oversight
[10:02:54]<mstenta[m]>no, only individual strings can be translated
[10:03:14]<skipper_is[m]>Ah ok, I'll refactor that while I'm there :)
[10:04:14]<skipper_is[m]>Got to go shift some chickens first o/
[10:51:43]<paul121[m]>Cool!
[10:57:12]* todrobbins[m] has joined #farmos
[13:31:40]<skipper_is[m]>So with t(), translating text containing html - split the text and the HTML tags, and translate just the text?
[13:44:16]* farmBOT has joined #farmos
[13:45:19]<mstenta[m]>Yea usually
[13:45:58]<mstenta[m]>If the translated text includes a link or something else that needs to be translated, then that's an exception
[13:46:18]<mstenta[m]>The API.drupal.org page describes that I think
[13:50:55]* JustTB has quit (Quit: Leaving.)
[13:58:02]<skipper_is[m]>Yea, so inline tags were fine
[13:58:07]<skipper_is[m]>So <strong> is ok
[13:58:33]<skipper_is[m]>But unfortunately my addition of t() as broken something, somewhere.... and the weights nolonger appear on the profile page
[13:58:58]<skipper_is[m]>farm_livestock_weight_entity_view_alter nolonger seems to be firing
[14:23:48]<skipper_is[m]>I removed everything I changed from the server, and restored it back to the original FarmOS, and it is still not there
[14:28:20]<skipper_is[m]>...Clear CC...
[14:34:45]<mstenta[m]>Ah did CC help?
[14:34:49]<mstenta[m]>Was gonna suggest that
[14:43:48]<skipper_is[m]>Yea, straight away XD
[14:44:39]<skipper_is[m]>Just writing a pull now
[16:09:05]* lpuro[m] has joined #farmos
[18:02:25]* JustTB has joined #farmos
[18:22:33]* JustTB has quit (Quit: Leaving.)
[18:25:11]* JustTB has joined #farmos
[19:52:39]* laurademmel[m] has joined #farmos