Open s00d opened 5 months ago
I've caught a memory leak when using routeToObject instead of:
Copy code
const subRoute = {
name: route.name,
// ...
In this case, all tests start to lag. It seems like this issue might be relevant to any code where routeToObject is used
memory tests(10k requests)
regexp version
8.3.1
The bundle size on a real project with 8 locales, 20 pages, and 100 components. regexp version 387kb
8.3.1 436kb
Now there can be even 100 locales and the bundle will not keep increasing indefinitely.
"blog"
"/blog"
"/:locale(fr)/blog"
"blog___locale"
___locale
. This setup facilitates serving content in multiple languages, improving accessibility and user experience in different regions."/:locale(fr)/produits/:id()"
"products-id___locale___fr"
meta.locale
attribute is added to all routes to check if the module interacts properly with the route.Localized Route Configuration:
localizeRoutes
function dynamically adjusts routes based on localization settings, employing strategies such as prefixing routes or excluding the default locale prefix based on the configuration.Route Localization Logic:
localizeRoute
iterates over routes, applying localization settings based on the route's properties and specified options. This includes handling exceptions for redirect routes and integrating locale-specific paths and names.resolveRoute
function is crucial for determining the appropriate localized route based on the current locale, route specifications, and routing strategy. It evaluates whether the route parameter is a string representing a path or a route name and adjusts accordingly.I've fixed all the tests, but there are still some warnings left that I couldn't catch locally; my tests don't show them. Maybe you'll be able to catch them. The resolve function sometimes passes the locale parameter where it's not needed (to routes without a locale), but it's already possible to start reviewing and testing.
I also had to adjust two tests. One issue was related to i18n, and for the second one, I'm out of energy to fix it.
I was wondering if there might be an update on the timeline for merging this? Thank you for your time and consideration.
I was wondering if there might be an update on the timeline for merging this? Thank you for your time and consideration.
I was a bit busy the last few months but I'm still considering this feature as we're working v9, no timeline though.
β Type of change
π Description
The new version of this commit https://github.com/nuxt-modules/i18n/pull/2927 includes a new routing system. However, I was unable to complete the last two tests: specs/routing/prefix-and-default.spec.ts > localePath > route strategy: prefix_and_default > should be worked. These are related to link generation. Unfortunately, I still can't figure out how it works or how to fix it.
Everything is functioning now, please take a look when you have time.
The description was in the previous pull request.
π Checklist