! Please note that this is a snapshot of our old Bugzilla server, which is read only since May 29, 2020. Please go to gitlab.xfce.org for our new server !
Add ordinal indicators (st, nd, rd, th) to the clocks custom format.
Status:
RESOLVED: WONTFIX
Product:
Xfce4-panel

Comments

Description engineglue 2018-12-11 23:12:44 CET
For example:

1:49pm Tuesday the 11th

Currently, the best approximation would be:

%l:%M %A the %d

which results in:

1:49pm Tuesday the 11

Sample code:

function ordinal($num){
  $result = "th";
  if($num < 4 && > 20){
    switch (substr($num, -1)) {
      case 1:
        $result = "st";
        break;
      case 2:
        $result = "nd";
        break;
      case 3:
        $result = "rd";
        break;
    }
  }
  return $result;
}
Comment 1 engineglue 2018-12-11 23:13:55 CET
I forgot am/pm but you get what I'm sayin'.
Comment 2 Simon Steinbeiss editbugs 2019-07-26 09:22:11 CEST
That's impossible to get right for all languages. I guess you'd have to define custom prefixes and suffixes which translators could then fill in.
I don't think this will ever work reliably for all languages though...
Comment 3 engineglue 2019-07-26 19:15:08 CEST
Simon, good point about how it would work for other languages. Can we at least get it working for English?

I did minimal research on this and it seems like this is mainly an English problem. A few other common languages don't really have ordinals. They just put a period after the number. See this for reference:
http://www.typophile.com/node/42577
Comment 4 Simon Steinbeiss editbugs 2019-09-30 22:56:34 CEST
Sorry but I'm not interested in writing extra code that will only benefit one locale/language (even though it may be one of the most widespread languages). Either it's supported by GDateTime or we won't support it: https://developer.gnome.org/glib/stable/glib-GDateTime.html#g-date-time-format

Bug #14965

Reported by:
engineglue
Reported on: 2018-12-11
Last modified on: 2019-09-30

People

Assignee:
Nick Schermer
CC List:
1 user

Version

Version:
4.12.1

Attachments

Additional information