-
Notifications
You must be signed in to change notification settings - Fork 22
I18n nuxt #85
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: cms-i18n
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds comprehensive internationalization (i18n) support to a Nuxt CMS application powered by Directus. The implementation uses locale prefixes in URLs (e.g., /es/blog/post) while keeping the default locale unprefixed, and integrates with Directus's translation tables to serve localized content.
Key Changes:
- Added translation schema types and Directus collections for all content types (pages, posts, navigation, forms, etc.)
- Implemented server-side locale detection via middleware and URL rewriting
- Created i18n utilities for locale handling, translation merging, and link localization
- Updated all API endpoints and components to support locale-aware content fetching
Reviewed changes
Copilot reviewed 34 out of 34 changed files in this pull request and generated 27 comments.
Show a summary per file
| File | Description |
|---|---|
| cms-i18n/nuxt/shared/types/schema.ts | Adds TypeScript interfaces for 14+ translation collections and Language type |
| cms-i18n/nuxt/server/utils/i18n.ts | Server-side locale extraction and language fetching utilities |
| cms-i18n/nuxt/server/utils/directus-i18n.ts | Translation merging logic and Directus query builders for i18n |
| cms-i18n/nuxt/server/middleware/locale.ts | Extracts locale from URL and rewrites requests for file-based routing |
| cms-i18n/nuxt/server/api/sitemap.get.ts | Generates sitemap with alternate language links for all locales |
| cms-i18n/nuxt/server/api/site-data.get.ts | Fetches globals and navigation with locale-specific translations |
| cms-i18n/nuxt/server/api/search.get.ts | Adds translation support to search results |
| cms-i18n/nuxt/server/api/posts/*.ts | Updates post endpoints to fetch and merge translations |
| cms-i18n/nuxt/server/api/pages/one.get.ts | Adds i18n support for page fetching with nested blocks |
| cms-i18n/nuxt/middleware/locale.global.ts | Client-side middleware for locale extraction |
| cms-i18n/nuxt/app/router.options.ts | Adds locale-prefixed blog route alias |
| cms-i18n/nuxt/app/pages/blog/[slug].vue | Updates blog page with locale handling and alternate links |
| cms-i18n/nuxt/app/pages/[...permalink].vue | Updates catch-all page with locale support |
| cms-i18n/nuxt/app/lib/i18n/*.ts | Core i18n configuration and utility functions |
| cms-i18n/nuxt/app/layouts/default.vue | Adds locale-aware data fetching and HTML attributes |
| cms-i18n/nuxt/app/composables/useLocale.ts | Composable for accessing current locale in components |
| cms-i18n/nuxt/app/components/ui/dialog/*.vue | Code formatting improvements (spacing/indentation) |
| cms-i18n/nuxt/app/components/ui/input/Input.vue | Code formatting improvements |
| cms-i18n/nuxt/app/components/shared/LanguageSwitcher.vue | New language switcher component with dropdown |
| cms-i18n/nuxt/app/components/block/Posts.vue | Adds locale support for post block links |
| cms-i18n/nuxt/app/components/base/*.vue | Updates buttons and search with localized links |
| cms-i18n/nuxt/app/components/NavigationBar.vue | Adds language switcher and localized navigation links |
| cms-i18n/nuxt/app/components/Footer.vue | Adds localized footer links |
| cms-i18n/nuxt/app/app.vue | Removes static lang attribute (moved to layout) |
Comments suppressed due to low confidence (1)
cms-i18n/nuxt/app/components/base/BaseButton.vue:49
- Type casting to
anyfor record objects is unsafe. Theiconsrecord should be properly typed usingRecord<string, Component>or similar to maintain type safety.
const icons: Record<string, any> = {
arrow: ArrowRight,
plus: Plus,
};
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
No description provided.