Next.js Discord

Discord Forum

Language switcher

Answered
In&Out posted this in #help-forum
Open in Discord
Hey folks, im trying to make a CMS page and i want to add multiple language support, but in that cms people can make own stuff, words and i want that stuff to be translated as well, how would i go on about doing that?
Answered by Common Tern
The Google Translation API isn’t free—it’s a paid service. If you're okay with investing in it, you can go ahead and use it. Otherwise, you can handle language changes for static text using params in your Next.js application
View full answer

5 Replies

Common Tern
You can use next-i18next for language support. Keep a language parameter for every user-generated content (stuff) in your CMS, and change your content dynamically according to that parameter. For static UI text, use next-i18next's translation files. For dynamic content, either:

Let users enter translations manually per language (e.g., title_en, title_fr),

Or auto-translate using APIs like Google Translate on submission.

Finally, use the current locale (e.g., router.locale) to fetch and display the correct language version of each content.
Common Tern
The Google Translation API isn’t free—it’s a paid service. If you're okay with investing in it, you can go ahead and use it. Otherwise, you can handle language changes for static text using params in your Next.js application
Answer
oky thank yo