Skip to content

fix: localize dates for all shipped languages (import moment locales)#147

Open
everysingletear wants to merge 1 commit into
donetick:developfrom
everysingletear:fix/moment-locales
Open

fix: localize dates for all shipped languages (import moment locales)#147
everysingletear wants to merge 1 commit into
donetick:developfrom
everysingletear:fix/moment-locales

Conversation

@everysingletear

Copy link
Copy Markdown

Fixes #142.

LocalizationContext calls moment.locale(language) for the active language, but only moment/locale/ja was imported — so moment silently fell back to English date formatting for de, es, fr, nl, pt, zh-CN, ar (only en and ja were localized).

Change

Import each shipped locale statically in src/i18n/config.js, matching the existing moment/locale/ja line.

Why static (not dynamic)

The issue raised static vs dynamic import. I went static because it matches the existing pattern, is trivially reviewable, and moment locale bundles are tiny (a few KB each). If you'd rather keep the main bundle leaner, I'm happy to switch to a dynamic import() of just the active language's locale — just say the word.

Testing

  • npm run build passes; all imported locale files resolve.
  • Switching language to e.g. German now renders month/weekday names and relative times ("2 hours ago" → "vor 2 Stunden") in that language.

Note: ru is intentionally not included here — it comes with the Russian locale PR (#143).

moment.locale(language) runs for the active language, but only
moment/locale/ja was imported — so de/es/fr/nl/pt/zh-CN/ar fell back to
English date formatting. Import each shipped locale statically, matching
the existing ja import.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Non-English locales render dates in English (moment locale never imported)

1 participant