fix: pin RelativeDateTimeFormatter to en_US to stop mixed-locale labels#868
Merged
steipete merged 1 commit intosteipete:mainfrom May 8, 2026
Merged
Conversation
Five RelativeDateTimeFormatter sites lacked an explicit locale, so on non-English systems they emitted localized output (e.g. "1分钟前") next to hardcoded English labels like "Updated", producing strings such as "Updated 1分钟前". The same field flipped to "Updated just now" inside the 60-second window, visibly switching languages while the menu was open. Pin every RelativeDateTimeFormatter to Locale(identifier: "en_US"), matching the en_US / en_US_POSIX pattern already used by every other formatter in UsageFormatter.swift. Tighten the existing relative-updated test, which previously accepted Korean output as a workaround for this bug, to assert English output. Closes steipete#866
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Updated 1分钟前, then flipped toUpdated just nowonce the snapshot got within 60 s — the same field visibly switching languages while the menu was open.RelativeDateTimeFormatterinstances never setformatter.locale, while every surrounding string (Updated,just now,Xm ago,last attempt …,Resets …) is hardcoded English. Other formatters in the same files already pinLocale(identifier: "en_US"/"en_US_POSIX")(seeUsageFormatter.usdString); these sites just missed the pattern.Changes
Sources/CodexBarCore/UsageFormatter.swift—updatedString.Sources/CodexBar/Date+RelativeDescription.swift—RelativeTimeFormatters.full.Sources/CodexBar/PreferencesGeneralPane.swift— tokenlast attempt …line.Sources/CodexBarCore/Providers/Augment/AugmentStatusProbe.swift— Augment reset-date formatter.Sources/CodexBarWidget/CodexBarWidgetViews.swift— widget relative date.Tests/CodexBarTests/UsageFormatterTests.swift— tightened therelative updated recenttest, which previously accepted Korean output (시간) as a workaround for this bug, to assert English output.Verification
Reproduced and confirmed with a standalone Swift snippet that mirrors
updatedStringunderLocale.current = zh_CN:Updated 5小时前Updated 5h agoI could not run
swift testlocally — the SwiftPM CLI hits an unrelatedexternal macro implementation type 'PreviewsMacros.SwiftUIView' could not be founderror inside the third-partyKeyboardShortcutspackage's#Preview { … }previews, andxcodebuildrequires Xcode (this machine only has CommandLineTools). The change is mechanical, follows the existing locale-pinning pattern inUsageFormatter.swift, and the updated test asserts the corrected behavior; please rely on CI to confirm.Test plan
swift testgreen (esp.UsageFormatterTests/relative updated recent).zh_CN/ja_JP/ko_KRsystem, open the menu bar popover and confirm theUpdated …line stays fully English (Updated just now,Updated 5h ago,Updated <time>).last attempt …text is English.