YOURLS icon indicating copy to clipboard operation
YOURLS copied to clipboard

Localization support for date and time display

Open infinitail opened this issue 10 months ago • 1 comments

Proposed functionality

In YOURLS, values like "M d, Y H:i" are passed as arguments to the yourls_date_i18n() function. I would like these arguments to be treated as localization targets using the yourls__() function. While it may be possible to handle this through filters, I believe addressing it through localization is more natural.

Use case

Site users will be able to use date formats that follow their locale.

Potential solution

Rewrite code like below. No potential impact for the current user.

-   yourls_date_i18n( yourls_get_datetime_format('M d, Y H:i'), yourls_get_timestamp( $timestamp ))
+   yourls_date_i18n( yourls_get_datetime_format( yourls__('M d, Y H:i') ), yourls_get_timestamp( $timestamp ))

infinitail avatar Jun 17 '25 01:06 infinitail

Indeed. We translate individual words like day and month, but not the whole date format. Image

ozh avatar Jun 17 '25 21:06 ozh