To achieve the desired functionality where the alternate language links include the current pathname with the locale prefix, u need to dynamically generate the URLs based on the current route. u can do this in a next.js multi-language app:
- Dynamic Metadata Generation: create a helper function to generate the alternate URLs dynamically based on the current route and the supported languages.
- Access the Current Path: u may need to access the current path in a way that works both on the server and the client.
- Combine Metadata with Generated URLs: combine the generated URLs with the metadata configuration.