How to have a Multi-lingual website with Nestjs?

Viewed 621

My problem

Hi everyone!
I'm using Nestjs with Nunjuks as my view engine to render HTML.
Now, I need to someone help me figure out how can I implement Multi-lingual for my project.
In my view, I have some content I want to show them based on the user's language.

Consider these:
/en/about
/fa/about
/ar/about
... and other routes ...

How can I implement my routes to support the language flag, and detect the language and show the content based on that language? And of course, store the language for future page loads to see content in that language.
For sure, it's not a good practice to set all routes with /:lang flag manually. It should be another better way for that!

nestjs-i18n

I've found this package that can help me to detect the language based on user cookies. Big help, but still having problems with supporting routes for language flag.

0 Answers
Related