Skip to content

refactor: virtuals and constants naming consistency #3707

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

Merged
merged 1 commit into from
Jun 27, 2025

Conversation

BobbieGoede
Copy link
Member

@BobbieGoede BobbieGoede commented Jun 26, 2025

🔗 Linked issue

📚 Description

Summary by CodeRabbit

  • Refactor
    • Updated internal naming conventions for i18n-related modules and constants, leading to more consistent and streamlined identifiers throughout the codebase.
    • Removed outdated or redundant constants and module references.
    • Adjusted import paths to match new naming conventions for improved maintainability.
  • Chores
    • Updated test configuration to reflect new module naming and removed obsolete aliases.

@BobbieGoede BobbieGoede self-assigned this Jun 26, 2025
Copy link
Contributor

coderabbitai bot commented Jun 26, 2025

Walkthrough

This change standardizes module and import paths by replacing dots with hyphens in i18n-related filenames and updates all references accordingly. Several composable constant names are shortened and unified. The logger module and related aliases are removed. No logic or control flow is altered, only naming and import path conventions.

Changes

File(s) Change Summary
internals.d.ts, vitest.config.test.ts Module declaration and alias for #build/i18n.options.mjs renamed to #build/i18n-options.mjs; logger module/alias removed.
src/constants.ts Composable constants renamed to shorter forms; template options key removed.
src/nitro.ts, src/prepare/auto-imports.ts, src/prepare/runtime.ts, src/pages.ts,
src/transform/macros.ts, src/transform/resource.ts Updated composable constant imports and references to new names.
src/runtime/context.ts, src/runtime/plugins/dev.ts, src/runtime/plugins/i18n.ts,
src/runtime/plugins/preload.ts, src/runtime/shared/detection.ts,
src/runtime/shared/domain.ts, src/runtime/shared/locales.ts,
src/runtime/shared/vue-i18n.ts Import paths updated from #build/i18n.options.mjs to #build/i18n-options.mjs.
src/runtime/server/plugin.ts, src/runtime/server/utils/locale-detector.ts Import paths updated from #internal/i18n/locale.detector.mjs to #internal/i18n-locale-detector.mjs.
src/runtime/server/type-generation.ts, src/runtime/server/utils/messages.ts Import paths updated from #internal/i18n/options.mjs to #internal/i18n-options.mjs.
src/transform/heist.ts Resource replacement logic refactored to use a loop and updated resource filenames.

Sequence Diagram(s)

sequenceDiagram
    participant SourceFile
    participant Constants
    participant BuildModule
    participant InternalModule

    SourceFile->>Constants: Import new composable constant (e.g., DEFINE_I18N_ROUTE_FN)
    SourceFile->>BuildModule: Import from '#build/i18n-options.mjs'
    BuildModule->>InternalModule: Resource replacement '#build/<resource>' → '#internal/<resource>'
Loading

Suggested labels

cr-tracked

Poem

🐇
Hop, hop, the names align,
Dots to dashes—how they shine!
Constants trimmed, imports neat,
Logger gone, the code’s complete.
Paths now match from end to start,
A tidy warren, code with heart!
🥕

✨ Finishing Touches
  • 📝 Generate Docstrings

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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
src/runtime/server/utils/messages.ts (1)

1-15: Guard against missing locale loaders

localeLoaders[locale] may be undefined for a mis-configured or dynamic locale; passing that into getLocaleMessagesMerged will crash. Add a check before the call:

-  return { [locale]: await getLocaleMessagesMerged(locale, localeLoaders[locale]) }
+  const loader = localeLoaders[locale]
+  if (!loader) {
+    throw new Error(`No message loader registered for locale "${locale}"`)
+  }
+  return { [locale]: await getLocaleMessagesMerged(locale, loader) }
src/runtime/shared/vue-i18n.ts (1)

2-3: Drop leading underscore on aliased import

The underscore convention signals “unused”, yet the variable is used below. Import it without the underscore for clarity:

-import { vueI18nConfigs, localeCodes as _localeCodes } from '#build/i18n-options.mjs'
+import { vueI18nConfigs, localeCodes } from '#build/i18n-options.mjs'
...
-  for (const locale of _localeCodes) {
+  for (const locale of localeCodes) {
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ad613b7 and 9b900f5.

📒 Files selected for processing (22)
  • internals.d.ts (3 hunks)
  • src/constants.ts (1 hunks)
  • src/nitro.ts (5 hunks)
  • src/pages.ts (3 hunks)
  • src/prepare/auto-imports.ts (2 hunks)
  • src/prepare/runtime.ts (1 hunks)
  • src/runtime/context.ts (1 hunks)
  • src/runtime/plugins/dev.ts (1 hunks)
  • src/runtime/plugins/i18n.ts (1 hunks)
  • src/runtime/plugins/preload.ts (1 hunks)
  • src/runtime/server/plugin.ts (1 hunks)
  • src/runtime/server/type-generation.ts (1 hunks)
  • src/runtime/server/utils/locale-detector.ts (1 hunks)
  • src/runtime/server/utils/messages.ts (1 hunks)
  • src/runtime/shared/detection.ts (1 hunks)
  • src/runtime/shared/domain.ts (1 hunks)
  • src/runtime/shared/locales.ts (1 hunks)
  • src/runtime/shared/vue-i18n.ts (1 hunks)
  • src/transform/heist.ts (2 hunks)
  • src/transform/macros.ts (1 hunks)
  • src/transform/resource.ts (2 hunks)
  • vitest.config.test.ts (1 hunks)
🧰 Additional context used
🧠 Learnings (17)
src/runtime/shared/detection.ts (4)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
src/runtime/plugins/dev.ts (5)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3584
File: src/runtime/server/context.ts:1-4
Timestamp: 2025-05-04T11:52:41.396Z
Learning: In Nuxt applications, `$fetch` is globally available and doesn't need to be explicitly imported.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
src/prepare/runtime.ts (4)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
src/runtime/plugins/preload.ts (5)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3584
File: src/runtime/server/context.ts:1-4
Timestamp: 2025-05-04T11:52:41.396Z
Learning: In Nuxt applications, `$fetch` is globally available and doesn't need to be explicitly imported.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
src/runtime/shared/locales.ts (4)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
src/transform/macros.ts (2)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
src/runtime/shared/vue-i18n.ts (4)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
src/runtime/server/plugin.ts (3)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3584
File: src/runtime/server/context.ts:1-4
Timestamp: 2025-05-04T11:52:41.396Z
Learning: In Nuxt applications, `$fetch` is globally available and doesn't need to be explicitly imported.
src/runtime/plugins/i18n.ts (5)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3584
File: src/runtime/server/context.ts:1-4
Timestamp: 2025-05-04T11:52:41.396Z
Learning: In Nuxt applications, `$fetch` is globally available and doesn't need to be explicitly imported.
src/runtime/server/utils/locale-detector.ts (3)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3584
File: src/runtime/server/context.ts:1-4
Timestamp: 2025-05-04T11:52:41.396Z
Learning: In Nuxt applications, `$fetch` is globally available and doesn't need to be explicitly imported.
src/transform/resource.ts (4)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
src/prepare/auto-imports.ts (5)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3584
File: src/runtime/server/context.ts:1-4
Timestamp: 2025-05-04T11:52:41.396Z
Learning: In Nuxt applications, `$fetch` is globally available and doesn't need to be explicitly imported.
src/runtime/context.ts (3)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3584
File: src/runtime/server/context.ts:1-4
Timestamp: 2025-05-04T11:52:41.396Z
Learning: In Nuxt applications, `$fetch` is globally available and doesn't need to be explicitly imported.
src/pages.ts (4)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
src/nitro.ts (5)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3584
File: src/runtime/server/context.ts:1-4
Timestamp: 2025-05-04T11:52:41.396Z
Learning: In Nuxt applications, `$fetch` is globally available and doesn't need to be explicitly imported.
src/constants.ts (4)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
internals.d.ts (4)
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In the nuxt-modules/i18n package, `_nuxtI18nCtx.setLocale` is a synchronous function that accepts a string locale parameter and returns void. It doesn't need to be awaited when called.
Learnt from: BobbieGoede
PR: nuxt-modules/i18n#3587
File: src/runtime/plugins/route-locale-detect.ts:24-31
Timestamp: 2025-05-05T20:42:02.900Z
Learning: In nuxt-modules/i18n's route detection, the `detectLocale` function returns a string representing the locale code, not an object. This string can be passed directly to `ctx.setLocale`.
🧬 Code Graph Analysis (5)
src/transform/macros.ts (1)
src/constants.ts (1)
  • DEFINE_I18N_ROUTE_FN (89-89)
src/transform/resource.ts (1)
src/constants.ts (2)
  • DEFINE_I18N_LOCALE_FN (90-90)
  • DEFINE_I18N_CONFIG_FN (91-91)
src/prepare/auto-imports.ts (1)
src/constants.ts (3)
  • DEFINE_I18N_ROUTE_FN (89-89)
  • DEFINE_I18N_LOCALE_FN (90-90)
  • DEFINE_I18N_CONFIG_FN (91-91)
src/pages.ts (1)
src/constants.ts (1)
  • DEFINE_I18N_ROUTE_FN (89-89)
src/nitro.ts (1)
src/constants.ts (3)
  • DEFINE_I18N_LOCALE_FN (90-90)
  • DEFINE_I18N_CONFIG_FN (91-91)
  • DEFINE_LOCALE_DETECTOR_FN (92-92)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test (lts/*, ubuntu-latest)
  • GitHub Check: test (lts/*, windows-latest)
🔇 Additional comments (22)
src/runtime/plugins/dev.ts (1)

1-1: Confirm new virtual-module alias is wired up

#build/i18n-options.mjs will only resolve if the build step now emits that file/alias. Run a quick build‐prepare to ensure the rename was propagated; otherwise the module resolver will throw at runtime.

pnpm dev:prepare && rg -n "#build/i18n-options.mjs" .         # expect hits in .nuxt/dist
src/runtime/shared/detection.ts (1)

3-3: Make sure the renamed virtual file is emitted for both client & server

normalizedLocales is referenced in browser-only branches (navigator detector). Verify that the build pipeline outputs the virtual module to both bundles:

rg -n "normalizedLocales" .nuxt                                                    # should return at least one client-side file
src/runtime/context.ts (1)

4-4: Compilation sanity-check for the new #build/i18n-options.mjs path

Run a full build or nuxi prepare to ensure the alias change doesn’t break module resolution here as well.

src/runtime/shared/locales.ts (1)

1-1: LGTM: Consistent naming convention applied.

The import path update from #build/i18n.options.mjs to #build/i18n-options.mjs follows the standardized naming pattern established in this refactoring.

src/runtime/shared/domain.ts (1)

2-2: LGTM: Import path standardization applied consistently.

The import path update maintains consistency with the naming convention changes across the codebase.

src/runtime/server/type-generation.ts (1)

2-2: LGTM: Internal module path standardization.

The import path update from #internal/i18n/options.mjs to #internal/i18n-options.mjs correctly applies the hyphenated naming convention to internal modules.

vitest.config.test.ts (1)

12-12: LGTM: Test configuration updated to match new module names.

The alias configuration correctly reflects the renamed module path, ensuring tests can resolve the updated import paths.

src/runtime/server/plugin.ts (1)

12-12: ```shell
#!/bin/bash

Description: Re-check for any remaining old module path references without relying on rg’s built-in types

echo "Verifying no remaining old module path references..."

Search across TS, JS, and Vue files for old build and internal module paths

rg -g '.{ts,js,vue}' '#build/i18n.options.mjs'
rg -g '
.{ts,js,vue}' '#internal/i18n/options.mjs'
rg -g '*.{ts,js,vue}' '#internal/i18n/locale.detector.mjs'

echo "Verification complete. Any results above indicate outdated imports that need updating."


</details>
<details>
<summary>src/runtime/plugins/preload.ts (1)</summary>

`4-4`: **LGTM! Import path updated consistently with refactoring.**

The import path change from `#build/i18n.options.mjs` to `#build/i18n-options.mjs` aligns with the standardization of module paths using hyphens instead of dots.

</details>
<details>
<summary>src/runtime/plugins/i18n.ts (1)</summary>

`4-4`: **LGTM! Import path updated consistently with refactoring.**

The import path change from `#build/i18n.options.mjs` to `#build/i18n-options.mjs` maintains consistency with the module path standardization across the codebase.

</details>
<details>
<summary>src/prepare/runtime.ts (1)</summary>

`47-47`: **LGTM! Filename updated to use hardcoded string after constant removal.**

The change from using `NUXT_I18N_TEMPLATE_OPTIONS_KEY` to the hardcoded string `'i18n-options.mjs'` is consistent with the constant removal and the new hyphenated naming convention.

</details>
<details>
<summary>src/runtime/server/utils/locale-detector.ts (2)</summary>

`3-3`: **LGTM! Internal module path updated consistently.**

The import path change from `#internal/i18n/locale.detector.mjs` to `#internal/i18n-locale-detector.mjs` follows the standardized naming convention.

---

`7-7`: **LGTM! Internal module path updated consistently.**

The import path change from `#internal/i18n/options.mjs` to `#internal/i18n-options.mjs` aligns with the module path standardization across the codebase.

</details>
<details>
<summary>src/transform/macros.ts (2)</summary>

`13-13`: **LGTM! Constant import updated with shortened name.**

The import change from `NUXT_I18N_COMPOSABLE_DEFINE_ROUTE` to `DEFINE_I18N_ROUTE_FN` follows the pattern of shortening composable constant names while maintaining the same functionality.

---

`17-17`: **LGTM! Regular expression updated to use new constant.**

The regex now correctly uses the new constant `DEFINE_I18N_ROUTE_FN`, maintaining the same functionality with the renamed constant.

</details>
<details>
<summary>src/transform/resource.ts (1)</summary>

`4-4`: **LGTM! Consistent constant renaming applied correctly.**

The refactoring from `NUXT_I18N_COMPOSABLE_*` to `DEFINE_I18N_*_FN` naming pattern improves readability and consistency. The import and usage are correctly updated.



Also applies to: 21-21

</details>
<details>
<summary>src/prepare/auto-imports.ts (1)</summary>

`1-1`: **LGTM! Auto-imports updated with consistent constant naming.**

The constant renaming is properly applied throughout the auto-imports configuration, maintaining functionality while improving consistency.



Also applies to: 30-32

</details>
<details>
<summary>src/pages.ts (1)</summary>

`10-10`: **LGTM! Consistent constant renaming in page analysis logic.**

The `DEFINE_I18N_ROUTE_FN` constant is properly imported and used throughout the component parsing logic. The refactoring maintains all functionality while improving naming consistency.



Also applies to: 389-389, 402-402

</details>
<details>
<summary>src/transform/heist.ts (1)</summary>

`20-20`: **Excellent refactoring! Improved maintainability and path consistency.**

The changes accomplish two improvements:
1. **Path normalization**: Updates from dotted (`i18n.options.mjs`) to hyphenated (`i18n-options.mjs`) naming for consistency
2. **Code maintainability**: Replaces individual `replaceAll` calls with a maintainable loop approach

This makes future resource additions easier and ensures consistent path handling.



Also applies to: 43-45

</details>
<details>
<summary>src/nitro.ts (1)</summary>

`14-16`: ```shell
#!/bin/bash
# Verify the constant definition and its usages across the codebase

# Show the definition in src/constants.ts
rg -n "DEFINE_I18N_CONFIG_FN" -C2 src/constants.ts

# Search for literal occurrences of both casings in strings
rg -n "'defineI18NConfig'" .
rg -n "'defineI18nConfig'" .

# Search for usage in code (unquoted)
rg -n defineI18NConfig .
rg -n defineI18nConfig .
internals.d.ts (1)

1-1: LGTM! Consistent module naming standardization.

The module path changes from dots to hyphens create better naming consistency across internal modules. The standardized naming convention improves readability and maintainability.

Also applies to: 13-13, 23-23

src/constants.ts (1)

89-92: LGTM! Improved constant naming consistency.

The shortened constant names with consistent _FN suffix are more concise and clearly indicate these represent function names. The removal of the redundant NUXT_I18N_COMPOSABLE_ prefix improves readability while maintaining clarity.

@BobbieGoede BobbieGoede merged commit 591fa0d into next Jun 27, 2025
15 of 16 checks passed
@BobbieGoede BobbieGoede deleted the refactor/virtual-template-filename-consistency branch June 27, 2025 00:43
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.

1 participant