Format dates with lingui/core#1730
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughThis update removes the old date formatting component and its exports, introduces a new Svelte date formatting component and utility function, and updates imports and usage in the project to use the new function-based approach. Localization files are updated to support a placeholder for formatted dates and to adjust metadata. Changes
Poem
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
frontend/viewer/src/locales/es.json (1)
1063-1065: Provide Spanish translation for new placeholder key
The obsolete static"Last change: "entry is marked obsolete, and the new"rZkl7/"key needs a proper Spanish translation (e.g."Último cambio: {0}").frontend/viewer/src/locales/en.json (1)
1063-1065: Remove or translate obsolete entry
The static"Last change: "entry is marked obsolete. Consider removing it entirely or ensuring the new placeholder key"rZkl7/"supersedes it in all translations.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
frontend/pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (8)
frontend/viewer/src/lib/components/ui/format-date/format-date.svelte(0 hunks)frontend/viewer/src/lib/components/ui/format-date/index.ts(0 hunks)frontend/viewer/src/lib/components/ui/format/format-date.svelte(1 hunks)frontend/viewer/src/lib/components/ui/format/index.ts(1 hunks)frontend/viewer/src/locales/en.json(4 hunks)frontend/viewer/src/locales/es.json(4 hunks)frontend/viewer/src/locales/fr.json(4 hunks)frontend/viewer/src/project/SyncDialog.svelte(3 hunks)
💤 Files with no reviewable changes (2)
- frontend/viewer/src/lib/components/ui/format-date/index.ts
- frontend/viewer/src/lib/components/ui/format-date/format-date.svelte
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Build API / publish-api
- GitHub Check: Analyze (csharp)
- GitHub Check: Build FW Lite and run tests
🔇 Additional comments (6)
frontend/viewer/src/lib/components/ui/format/index.ts (1)
1-6: Centralized export of date formatting utilities looks good
This new module cleanly re-exports both the Svelte component and the utility function for date formatting.frontend/viewer/src/locales/es.json (1)
21-21: Verify updated origin line reference
The"mpbC3j"key’s origin is now pointing to line 233 inSyncDialog.svelte. Please confirm this matches the updated source.frontend/viewer/src/project/SyncDialog.svelte (1)
13-13: Good: importing the newformatDateutility
This replaces the old component-based import. Ensure that all oldFormatDateimports are removed across the codebase.frontend/viewer/src/locales/en.json (1)
21-21: Verify updated origin line references
Several keys ("mpbC3j","UNnBU9","ivpwMF") have updated line numbers inSyncDialog.svelte. Please confirm these align with the refactored template.Also applies to: 1930-1930, 1950-1950
frontend/viewer/src/locales/fr.json (1)
1066-1081: LGTM! Localization key properly updated for inline date formatting.The transition from "Last change: " to "Last change: {0}" with a placeholder correctly supports the new function-based date formatting approach. The obsolete marking of the old key ensures proper cleanup.
frontend/viewer/src/lib/components/ui/format/format-date.svelte (1)
12-32: Excellent implementation of the new date formatting component.The component properly:
- Uses modern Svelte 5 syntax with
$props()and$derived()- Handles HTML attributes correctly via spread
- Provides a clean API with sensible defaults
- Integrates well with lingui/core for localized formatting
This aligns perfectly with the PR objective of leveraging lingui/core's built-in date formatting capabilities.
269c0c2 to
2b7d8af
Compare
|
The latest updates on your projects. Learn more about Argos notifications ↗︎
|
# Conflicts: # frontend/viewer/src/lib/components/ui/format/format-date.svelte # frontend/viewer/src/lib/components/ui/format/index.ts # frontend/viewer/src/lib/sandbox/Sandbox.svelte # frontend/viewer/src/project/SyncDialog.svelte
Turns out we already had a date-formatter in lingui/core, so I dropped the one that bits-ui uses.
It still supports the current locale, but implicitly, because lingui already knows what the current locale is.
English:

French:
