Repository navigation
Conversation
hoge6b01
force-pushed
the
fix/localize-dates-and-recurrence
branch
2 times, most recently
from
November 25, 2026 07:07
8e45663 to
d1e61d8
Compare
Task cards always showed "15 hours ago", "Tomorrow 07:30" or "Daily except Sat, Sun" in English, whatever the language: - moment locales were imported from moment/locale/*, whose UMD files register on a second CommonJS copy of moment under Vite, so none of them ever applied. Import from moment/dist/locale/* instead and add the missing ar, de, fr, nl, pt-br and zh-cn. - Chip helpers hardcoded English words and parsed stored day and month names with the active locale (every day became Sunday outside English). They now use i18next and index-based day/month lookups. - useDateFormatter reset the global moment locale to English via updateLocale. - Arabic keeps Western digits so ISO strings sent to the API stay machine-readable. New keys are translated into all base locales with each language's plural categories. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
hoge6b01
force-pushed
the
fix/localize-dates-and-recurrence
branch
from
December 1, 2026 19:15
d1e61d8 to
5edb00d
Compare
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
Due-date and repeat chips on task cards (Home, task list, project rows and board cards) were always English, whatever language was selected: "15 hours ago", "Tomorrow 07:30", "Weekly", "Daily except Sat, Sun". This PR localizes them and fixes three bugs I found along the way.
Root causes
src/i18n/config.jsimportedmoment/locale/<lang>. Under Vite,import moment from 'moment'resolves to the ESM build (moment/dist/moment.js), but the UMD files inmoment/locale/require('../moment'), which is a second CommonJS copy. The locales were registered on that copy andmoment.locale('de')quietly fell back to English. The existing imports (cs, he, ru, ja, es, pl, it) never worked either. They now come frommoment/dist/locale/*, which share the app's instance. The production bundle now holds a single moment copy.ptmaps to moment'spt-br, because the app offers it as Portuguese (Brazil).getRecurrentChipTextpassed stored English names tomoment().day('monday')/moment().month('march'). These parse with the current locale, so in any other language every day turned into Sunday and every month into the current one. With the locale fix, German would have hit this too. Days and months are now converted to indexes first.useDateFormatterreset the global locale.moment.updateLocale('en', …)also makesenthe global locale, so opening the archive turned every date in the app back to English. The previous locale is now restored.Changes
ChoreCardHelpers: "Today/Tomorrow/Yesterday", "N days", "No Due Date", the frequency names, "Daily except …", "Monthly … except …" and "Every N …" now go through i18next. Ordinals usemoment.localeData().ordinal()instead of the English st/nd/rd/th. Date-only chips no longer cut the calendar label at the first space, which broke multi-word translations.CompactChoreCardno longer passes an unusedtas a fourth argument togetDueDateChipText.LocalizationContext.formatCalendaruses the same translated calendar words, including "Last {{day}}".postformatis overridden). This is needed for correctness, not just for looks: with the stockarlocale,moment().format()returns٢٠٢٦-١١-٠٩T١٨:٠٠:٠٠+٠١:٠٠, andRepeatSection/RepeatPickerFieldsend such strings to the API. It also keeps moment output consistent with the counts and inputs in the rest of the UI.common.calendar.*,chores.dueChip.*andchores.repeatChip.*. They are translated into all base locales (ar, cs, de, es, fr, he, it, ja, nl, pl, pt, ru, zh) with every plural category each language needs. Exactly one interval unit ("Every week") has its ownrepeatChip.everyUnit.*key. Reusing the_oneplural form for it would be wrong in Russian, which uses that form for 21, 31, … as well.Testing
tests/chore-card-helpers.test.mjsruns the real helpers against real moment locales and i18next loaded with the shipped locale files. It covers weekday/month names, daily-except, ordinals, plural forms (including the Arabic dual) and calendar words. It also checks that every locale with the new strings has all of its plural categories. 6 of the 8 tests fail against the old helper ondevelop.node --test tests/*.test.mjsshows no new failures compared todevelop.npx eslintandnpx prettier -con the changed files,npm run lint:i18nandscripts/i18n/i18n-pr-safety.mjsall pass. The safety check gives one warning: Dutch "Trigger" equals the English text, which is intended.vite buildsucceeds.Claude (Anthropic's AI assistant) helped with the analysis, implementation and translations; I reviewed all changes.
🤖 Generated with Claude Code