Skip to content

fix(i18n): localize hardcoded "tomorrow" in reset time display#1568

Merged
steipete merged 4 commits into
steipete:mainfrom
tukuyomil032:upstream-pr/localize-tomorrow-string
Jun 16, 2026
Merged

fix(i18n): localize hardcoded "tomorrow" in reset time display#1568
steipete merged 4 commits into
steipete:mainfrom
tukuyomil032:upstream-pr/localize-tomorrow-string

Conversation

@tukuyomil032

Copy link
Copy Markdown
Contributor

Summary

UsageFormatter.resetDescription() returned the English word "tomorrow" verbatim regardless of the user's locale setting. Under Japanese (and all other non-English locales) this produced mixed-language output:

"tomorrow 10:50 にリセット"

Root cause

The string was hardcoded directly in Swift:

return "tomorrow, \(date.formatted(.dateTime.hour().minute().locale(self.currentLocale())))"

While same-day and future-date resets were correctly formatted using DateFormatter with the current locale, "tomorrow" was never routed through the localization system.

Fix

Replaced the hardcoded string with a new reset_tomorrow_format key run through localized(). Each locale controls the word, punctuation, and word order independently — for example, Japanese omits the comma: "明日 %@".

Added reset_tomorrow_format to all 18 supported language files with native translations:

Locale Translation
ja 明日 %@
ko 내일 %@
zh-Hans / zh-Hant 明天 %@
fr demain, %@
de / nl morgen, %@
es mañana, %@
it domani, %@
pt-BR amanhã, %@
pl jutro, %@
sv imorgon %@
tr yarın, %@
uk завтра, %@
ca demà, %@
vi ngày mai, %@
id besok, %@
en tomorrow, %@

Copilot AI review requested due to automatic review settings June 16, 2026 01:53

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

This PR localizes the “tomorrow at ” reset label by switching from hard-coded string interpolation to a localized format string.

Changes:

  • Added a new localization key reset_tomorrow_format across multiple Localizable.strings files.
  • Updated UsageFormatter to format “tomorrow” via localized string lookup + substitution instead of embedding English punctuation/wording in code.

Reviewed changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Sources/CodexBarCore/UsageFormatter.swift Uses a localized format key for “tomorrow, %@” instead of hard-coded English string interpolation
Sources/CodexBar/Resources/en.lproj/Localizable.strings Adds reset_tomorrow_format in English
Sources/CodexBar/Resources/zh-Hans.lproj/Localizable.strings Adds reset_tomorrow_format in Simplified Chinese
Sources/CodexBar/Resources/zh-Hant.lproj/Localizable.strings Adds reset_tomorrow_format in Traditional Chinese
Sources/CodexBar/Resources/vi.lproj/Localizable.strings Adds reset_tomorrow_format in Vietnamese
Sources/CodexBar/Resources/uk.lproj/Localizable.strings Adds reset_tomorrow_format in Ukrainian
Sources/CodexBar/Resources/tr.lproj/Localizable.strings Adds reset_tomorrow_format in Turkish
Sources/CodexBar/Resources/sv.lproj/Localizable.strings Adds reset_tomorrow_format in Swedish
Sources/CodexBar/Resources/pt-BR.lproj/Localizable.strings Adds reset_tomorrow_format in Brazilian Portuguese
Sources/CodexBar/Resources/pl.lproj/Localizable.strings Adds reset_tomorrow_format in Polish
Sources/CodexBar/Resources/nl.lproj/Localizable.strings Adds reset_tomorrow_format in Dutch
Sources/CodexBar/Resources/ko.lproj/Localizable.strings Adds reset_tomorrow_format in Korean
Sources/CodexBar/Resources/ja.lproj/Localizable.strings Adds reset_tomorrow_format in Japanese
Sources/CodexBar/Resources/it.lproj/Localizable.strings Adds reset_tomorrow_format in Italian
Sources/CodexBar/Resources/id.lproj/Localizable.strings Adds reset_tomorrow_format in Indonesian
Sources/CodexBar/Resources/fr.lproj/Localizable.strings Adds reset_tomorrow_format in French
Sources/CodexBar/Resources/es.lproj/Localizable.strings Adds reset_tomorrow_format in Spanish
Sources/CodexBar/Resources/ca.lproj/Localizable.strings Adds reset_tomorrow_format in Catalan

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +111 to +112
let timeStr = date.formatted(.dateTime.hour().minute().locale(self.currentLocale()))
return self.localized("reset_tomorrow_format", timeStr)
@steipete
steipete force-pushed the upstream-pr/localize-tomorrow-string branch from 910acca to 47d0a19 Compare June 16, 2026 05:01
tukuyomil032 and others added 4 commits June 16, 2026 06:36
UsageFormatter.resetDescription() returned the English word "tomorrow" verbatim,
causing mixed-language output like "tomorrow 10:50 にリセット" under Japanese locale.

Replace the hardcoded string with a new reset_tomorrow_format localization key that
embeds both the word and the time argument, letting each locale control word choice and
punctuation (e.g. "明日 %@" in Japanese vs "tomorrow, %@" in English).

Added reset_tomorrow_format to all 18 supported language files:
- ja: 明日 %@   ko: 내일 %@   zh-Hans/Hant: 明天 %@
- de/nl: morgen, %@   fr: demain, %@   es: mañana, %@
- it: domani, %@   pt-BR: amanhã, %@   pl: jutro, %@
- sv: imorgon %@   tr: yarın, %@   uk: завтра, %@
- ca: demà, %@   vi: ngày mai, %@   id: besok, %@

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@steipete
steipete force-pushed the upstream-pr/localize-tomorrow-string branch from 47d0a19 to a37b832 Compare June 16, 2026 05:37
@steipete
steipete merged commit ac01d73 into steipete:main Jun 16, 2026
4 checks passed
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.

3 participants