Skip to content

[i18n] Dates render in the visitor's browser locale, instead of the site's language #549

Description

@dio-gh

Summary

Dynamic dates on the site are formatted with the visitor's browser/OS locale instead of the site's configured language (en). On a non-English browser they render in the wrong language. The compatibility table's sort order has the same problem through localeCompare.

All three cases rely on the JavaScript Intl default locale, while the site is single-locale en (i18n in docusaurus.config.js).

Observed

Downloads > Stable Releases, viewed in a Hungarian browser. Release dates render in Hungarian ("2026. augusztus 28., péntek 22") rather than English:

Image

Affected code

1. Release list dates (downloads page)

const dateString = date.toLocaleDateString(undefined, {

date.toLocaleDateString(undefined, {...}). A undefined locale means the runtime default, i.e. the browser/OS language.

2. Compatibility "Tested on" tooltip

content={`Tested on - ${date.toLocaleString(DateTime.DATE_FULL)}`}

date.toLocaleString(DateTime.DATE_FULL) (Luxon). No locale passed, so it falls back to the runtime default.

3. Compatibility table sort order

compatRows.sort((a, b) => a.title.localeCompare(b.title));

a.title.localeCompare(b.title). No locale passed, so row collation shifts with the visitor's locale.

Proposed fix

Read the site locale once from useDocusaurusContext().i18n.currentLocale and pass it to each call:

  • downloads: toLocaleDateString(locale, {...})
  • compat tooltip: toLocaleString(DateTime.DATE_FULL, { locale })
  • compat sort: localeCompare(b.title, locale)

Sourcing from i18n.currentLocale keeps the value tied to the site config instead of a hardcoded string, so it tracks any future locale change.

PRs not open

Given the recent LLM contribution policy, as a new contributor, I have not opened a PR, since I used Claude for this. The proposed changeset is available on my fork for reference: https://github.com/dio-gh/pcsx2-net-www/tree/fix/release-date-locale

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions