Skip to content

Bug: Relative dates displayed in Chinese even when UI language is set to English #1029

@BaderEddineB

Description

@BaderEddineB

🐛 Bug: Relative dates displayed in Chinese even when UI language is set to English

Summary

When the UI language is set to English, relative dates (e.g. "6 months ago", "2 days ago") in the model deployment window are still rendered in Chinese. This is caused by dayjs locale not being synchronized with the app's selected language — it falls back to "zh-cn" instead of "en".


Environment

  • Deployment: Docker
  • UI language setting: English
  • Affected area: Model deployment window (and potentially other date fields)

Steps to Reproduce

  1. Deploy GPUStack via Docker
  2. Set the UI language to English in the settings
  3. Open the model deployment window
  4. Observe that relative dates (e.g. "6 months ago") are displayed in Chinese

Expected Behavior

All date strings should respect the selected UI language. When English is selected, dates should display as:

"6 months ago", "2 days ago", "just now", etc.

Actual Behavior

Dates are displayed in Chinese regardless of the UI language setting:

"6个月前", "2天前", etc.


Root Cause Analysis

The issue is located in the compiled frontend chunk file:

File: gpustack/ui/js/2729.<hash>.chunk.js

The dayjs locale initialization uses "zh-cn" as the hardcoded default fallback:

// Problematic code
useEffect(() => {
  dayjs().locale((locale) || "zh-cn")  // ← hardcoded Chinese fallback
}, [locale])

When the app locale is not yet resolved (e.g. on first load or during rendering), dayjs falls back to "zh-cn" instead of "en", causing Chinese date strings to appear momentarily or permanently depending on timing.


Workaround Applied (Docker)

As a temporary fix, we patched the compiled JS file directly inside the running container:

# Enter the container
docker exec -it <container_name> bash

# Apply the fix
sed -i 's/||"zh-cn")/||"en")/g' \
  /usr/local/lib/python3.11/dist-packages/gpustack/ui/js/2729.<hash>.chunk.js

# Restart the container
docker restart <container_name>

This replaces the hardcoded "zh-cn" fallback with "en", so dates are correctly displayed in English.

⚠️ Note: This workaround is lost on container recreation or image update. A proper fix in the source code is needed.


Suggested Fix (Source Code)

In the source file responsible for the dayjs locale initialization (likely src/locales/index.ts or similar), the fallback should use "en" or dynamically resolve from the app's language store:

// Before
dayjs.locale(appLocale || "zh-cn");

// After
dayjs.locale(appLocale || "en");

Impact

  • Affects all users who deploy GPUStack with a non-Chinese system/browser locale and set the UI to English
  • Particularly visible in the model deployment window for date fields showing model age

Reported after manual investigation on a Docker-based deployment.

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