mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-17 14:19:35 +00:00
fix(menubar): keep the English weekday row two letters wide
veryShortWeekdaySymbols gives en "M T W T F S S": two ambiguous pairs, and two duplicate ForEach ids. shortWeekdaySymbols clipped to two units keeps "Mo Tu We" in English and reads 周一 周二 in zh-Hans, 19.9pt in a 30pt cell.
This commit is contained in:
parent
f995593f2a
commit
82b02faa4f
1 changed files with 5 additions and 3 deletions
|
|
@ -65,10 +65,12 @@ private struct CalendarPopover: View {
|
|||
@State private var pending: Set<String> = []
|
||||
|
||||
private let calendar = Calendar.current
|
||||
/// Monday-first, from the current locale's own very-short weekday symbols
|
||||
/// (Sunday-indexed), so zh-Hans renders 一…日 without a translation key.
|
||||
/// Monday-first, from the locale's own short weekday symbols (Sunday-indexed)
|
||||
/// clipped to two units, so en keeps its existing `Mo Tu We` row and zh-Hans
|
||||
/// reads `周一 周二`. `veryShortWeekdaySymbols` would give English a row of
|
||||
/// `M T W T F S S` with two ambiguous pairs.
|
||||
private let weekdays: [String] = {
|
||||
let symbols = Calendar.current.veryShortWeekdaySymbols
|
||||
let symbols = Calendar.current.shortWeekdaySymbols.map { String($0.prefix(2)) }
|
||||
guard symbols.count == 7 else { return symbols }
|
||||
return Array(symbols[1...]) + [symbols[0]]
|
||||
}()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue