Respect user preferences when formatting timestamp (#7994)

This is a follow up to #7945. The current behaviour reads the locale and
infers from that which type of time format should be used (12 hour/24
hour).
However, in macOS you can override this behaviour, e.g. you can use
en_US locale but still use the 24 hour clock format (Can be customized
under Settings > General > Date & Format > 24-hour time). You can even
customize the date format.

This PR uses the macOS specific `CFDateFormatter` API, which outputs
time format strings, that respect those settings.

Partially fixes #7956 (as its not implemented for linux)

Release Notes:

- Added localization support for all macOS specific date and time
configurations in chat
This commit is contained in:
Bennet Bo Fenner 2024-02-24 03:18:06 +01:00 committed by GitHub
parent 7599933f30
commit dc7e14f888
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 571 additions and 263 deletions

View file

@ -37,7 +37,7 @@ parking_lot.workspace = true
postage.workspace = true
[target.'cfg(target_os = "macos")'.dependencies]
core-foundation = "0.9.3"
core-foundation.workspace = true
[target.'cfg(all(not(target_os = "macos")))'.dependencies]
async-trait = { workspace = true }
@ -69,7 +69,7 @@ simplelog = "0.9"
[target.'cfg(target_os = "macos")'.dev-dependencies]
cocoa = "0.25"
core-foundation = "0.9.3"
core-foundation.workspace = true
core-graphics = "0.22.3"
foreign-types = "0.3"
objc = "0.2"