ppy / osu

rhythm is just a *click* away!
https://osu.ppy.sh
MIT License
15.49k stars 2.3k forks source link

Hardcoded date formats used throughout game's code #21157

Open Susko3 opened 2 years ago

Susko3 commented 2 years ago

Type

Cosmetic

Bug description

Noticed while investigating https://github.com/ppy/osu/issues/21146.

Date formats are hardcoded throughout the code:

https://github.com/ppy/osu/blob/f8830c6850128456266c82de83273204f8b74ac0/osu.Game/Graphics/DateTooltip.cs#L72-L73

Using standard date format strings and properly utilising TranslatableString should help with this.

Screenshots or videos

Game:

image

Web:

image

Version

2022.1101.0

Logs

performance.log runtime.log updater.log database.log input.log network.log

Susko3 commented 1 year ago

(continuation from https://github.com/ppy/osu-framework/pull/5538#discussion_r1039044155)

osu-web

osu-web uses custom date format strings for some usages, defined per-language: Japanese, English.

I don't know from where it gets regular date format strings, but they are (mostly) appropriate for the currently selected language. Example:

image

image

Not using culture-appropriate format:

image

There is also this formatter for relative time.

osu

Using regular .NET date time format strings doesn't work, as they don't exactly match osu-web.

Someone using en-US might expect their dates to be formatted as June 15, 2009 and not 15 June 2009. osu! mostly uses the long date format with month names (where there is no ambiguity, at least in English), but there is one usage of the short date yyyy-MM-dd where the user might confuse the month and day.

So I though that re-using the existing localisation infrastructure and providing a custom format provider that formatted dates the same as osu-web could work. Using a format provider that respects not only the selected language in osu!, but also respects the user's date format (within reason) seemed like a good idea.