How to add multiple languages to your application.
SuperStarter includes a powerful internationalization package that enables you to add multiple language support to your application with minimal configuration. The package handles language detection, routing, and content management through a dictionary-based approach.
The internationalization system is built on Next.js Internationalization’s routing system and Languine’s translation system.
It’s configured by default for the web
package to:
/en/about
, /fr/about
)The package handles language detection and matching, ensuring users see content in their preferred language when available.
To enable automatic translations, simply create a .env
file in the internationalization
package and set the LANGUINE_PROJECT_ID
environment variable.
Languine offers 500 translation keys for free. If you need more, you need upgrade to a paid plan.
If you don’t want to use Languine, you can manually translate your content. You do not need to set the LANGUINE_PROJECT_ID
environment variable in this case.
The internationalization package is configured through a languine.json
file that defines:
en
)["es", "de"]
)Dictionaries are TypeScript files that export strongly-typed content for each supported language. The type system ensures consistency across translations:
There is no need to create a dictionary for any non-source locale, as Languine will automatically generate the translations for you.
To translate your application, you can run the following command:
This will translate all of the content in your application and save the translations to the dictionaries
folder.
To use the internationalization package, you need to:
You can find an example of a dictionary in the web
package:
You can change the locale of the application by changing the locale
parameter in the URL. For example, https://example.com/en/about
will render the about
page in English.
We’ve already configured the web
package with a language switcher, so you don’t need to worry about it.
The internationalization package also includes a middleware component that automatically detects the user’s language and routes them to the appropriate language-specific page.
This has already been configured for the web
package, so you don’t need to worry about it.