I18n with SvelteKit Form Actions

Опубликовано: 10 Июнь 2026
на канале: Matias Hernández
1,919
183

SvelteKit is already released and production ready. Let's use it to do something fun.

I'm bilingual, and I create bilingual content, so I wanted to allow users to consume content on my site based on their language preferences.

Using SvelteKit's form actions and server load is simple to implement a language picker that uses cookies to store user preferences.

Form actions are a simple but powerful feature that allows you to mutate data in the server using simple html forms (use the platform) and progressive enhancement.

In this case you can use a form element couple with a select input to set a server cookie to store the language preference of your users and then use that information to, for example, translate the site or filter what data is displayed.

The progressive enhancement feature of Sveltekit form actions allows you to have a fully functional way of mutating data even when JavaScript is not yet loaded or disabled.


Follow me on twitter for more   / matiasfha  

My site: https://matiashernandez.dev