lostium / ssr-i18n-angular17

This project is a basic example of how to use Server Side Rendering with multi-language (i18n) websites using Angular 17.
20 stars 6 forks source link

How about the main page? #3

Closed BimBoss closed 8 months ago

BimBoss commented 8 months ago

I cloned and launched the project, everything works well except the root URL. Is it possible to fix that? E.g. use the proper language based on the browser language? image

agarciar commented 8 months ago

You have different options for managing user language detection and corresponding redirection. One option is to implement the language detection logic and redirection within the proxy-server.mjs file. This involves modifying the proxy server to automatically detect the user's browser language and redirect them to the appropriate URL that corresponds to that language.

However, in our particular case, we use a reverse proxy like Nginx. This allows us to handle language detection and redirection differently. Instead of making changes directly in the application server, we configure Nginx to detect the user's language (usually through the 'Accept-Language' header sent by the browser) and, based on that information, redirect the user to the specific path that corresponds to their preferred language. This configuration is typically done in the Nginx configuration file, where rules are set up to parse the language header and define the appropriate redirection.