Skip to content

Automatic link localization #3884

@titusdecali

Description

@titusdecali

Describe the feature

I'm trying to find a more streamlined way to handle URL-based i18n locale routing with strategy: 'prefix' in my Nuxt applications. Currently, it seems that localePath() needs to be explicitly set on every link, which can be a bit repetitive.

I've explored using middleware to automatically manage this, but it appears nuxt/i18n's routing logic takes precedence and overrides these attempts with a default.

I'm sure there's a valid technical reason for this behavior, given the complexity of i18n implementation. However, I'm curious if there might be an alternative approach, perhaps leveraging middleware or a plugin within the nuxt/i18n package itself, to automatically apply the correct locale paths without requiring manual intervention on every link. Any insights into the underlying logic or potential solutions would be greatly appreciated!

Additional information

  • Would you be willing to help implement this feature?
  • Could this feature be implemented as a module?

Final checks

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions