Internationalization (i18n)
Flareforge is equipped with a comprehensive internationalization (i18n) system, allowing you to adapt your application’s content for different languages and regions. This means your application can seamlessly serve a global audience from day one.
This is powered by i18next, a robust internationalization framework.
Routing and SEO
Section titled “Routing and SEO”Flareforge applications use URL path prefixes to handle different languages for routing and SEO benefits:
- For non-default languages, the URL will include the locale code (e.g.,
yoursite.com/fr
). - The default language will always be served from the root path (e.g.,
yoursite.com/
).
This approach provides clean URLs that are easily indexable by search engines, helping your multi-language content rank effectively. Once a locale is set via the URL, it persists across your application’s dashboard and pages, ensuring a consistent language experience as the user navigates.
Add a new locale
Section titled “Add a new locale”Adding a new language to your Flareforge application involves a few straightforward steps:
-
Update
flareforge.jsonc
: Add the new locale code to thei18n.locales
array in yourflareforge.jsonc
file. For example, to add French:{"i18n": {"locales": ["en", "fr"],"defaultLocale": "en"}} -
Unforge the i18n files:
Terminal window npx flareforge unforge locale frTerminal window yarn flareforge unforge locale frTerminal window pnpm flareforge unforge locale frThis command will generate files like
locales/fr/dashboard.ts
. -
Open the newly created TypeScript files and replace the English strings with their translations in the new language.
The generated files are TypeScript and automatically provide type safety, ensuring you don’t miss any translation keys.
Once these steps are completed, your Flareforge application will automatically detect and serve content in the new language based on the URL prefix.