Next.js Discord

Discord Forum

Internationalization and Server Actions

Unanswered
Mini Satin posted this in #help-forum
Open in Discord
Mini SatinOP
I'm in the process of translating my site into multiple languages. I am using the App Router's builtin internationalization support described here: https://nextjs.org/docs/app/building-your-application/routing/internationalization

However I've come across an issue with server actions and I'm looking for best practice regarding this. I have (for example) a Server Action that sends out an SMS message to the user. Obviously I want this message to be localized as well. What would be the best way to implement this?

Only thing I can currently think of is sending a "locale" parameter to my server action and then grabbing the message from the dictionary file, but I was wondering if there was a more "elegant" solution to this?

Thanks!

0 Replies