s00d / nuxt-i18n-micro

Nuxt I18n Micro is a fast, simple, and lightweight internationalization (i18n) module for Nuxt
https://s00d.github.io/nuxt-i18n-micro/
MIT License
87 stars 11 forks source link

Query Parameter Lost in URL When Using localePath #58

Closed MariaAndreyeva closed 2 weeks ago

MariaAndreyeva commented 2 weeks ago

Title: Query Parameter Lost in URL When Using $localePath

Description:

I'm encountering an issue with the $localePath function, where query parameters are being lost from the URL. When I use $localePath to generate a localized path, any query parameters included in the original path are not preserved in the output.

Steps to Reproduce:

  1. Use the $localePath function with a URL that includes a query parameter.

    console.log($localePath('/home')); // Expected output: localized path for '/home'
    console.log($localePath('/home?test=test')); // Expected output: localized path for '/home?test=test'
  2. Observe the output in the console.

Expected Behavior:

The $localePath function should return the localized path while preserving any query parameters included in the input URL. For example:

Actual Behavior:

The query parameters are not included in the output. The function returns a path without the query string:

Environment:

Additional Context:

Possible Solution:

If possible, it would be helpful for $localePath to internally handle query parameters or provide an option to preserve them, as it was in version 1.27.1

s00d commented 2 weeks ago

fixed in v1.31.2