Localize post date and calendar month formatting #100
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
In crates/bds-ui/src/views/sidebar.rs, format_post_date uses chrono's unlocalized %b %d, %Y and month_abbr returns hardcoded English month abbreviations, violating the project i18n rule ("no untranslated string constants") and the PostDateFormat spec in specs/sidebar_views.allium (lines ~73-89), which requires toLocaleDateString(locale, month: short, day: numeric, year: numeric) via the LocaleMapping (en-US/de-DE/fr-FR/it-IT/es-ES). The workspace chrono dependency already has the unstable-locales feature enabled and there is a locale-mapping precedent in crates/bds-ui/src/i18n/relative_date.rs (format_locale + format_localized). Make format_post_date and the calendar month labels locale-aware, add unit tests, and note that cargo test --workspace must run on the macOS dev machine (no Rust toolchain on this Windows box).
Implemented in
0d44c21. Sidebar post dates now use the selected UI locale with the Allium/Intl month-day-year ordering and punctuation for en-US, de-DE, fr-FR, it-IT, and es-ES. Calendar archive month labels now use the same shared chrono locale mapping instead of hardcoded English names. Added exact unit coverage for all five post-date locales and representative localized month abbreviations, and updated the README. Neutral review matched the issue, bDS2 intent, and specs/sidebar_views.allium; outputs were also cross-checked against Intl.DateTimeFormat. Verification passed: cargo test --workspace, cargo build --workspace, strict cargo clippy, cargo machete, cargo fmt --check, allium check specs, and visual QA of the exact release macOS bundle in German (including Mär in the expanded calendar).