Discover a Smarter Way: Automating i18next Translations with saveMissing and Locize AI


The i18next community has always championed flexibility in localization workflows. While tools like the new i18next-cli
excel at extracting keys from your codebase, there's a powerful, alternative approach that can streamline your development and translation process even further: i18next's saveMissing
feature, supercharged by Locize's automatic machine translation.
This method shifts your focus from manual key extraction to a dynamic, real-time workflow where translation keys are created and automatically translated as you develop. It's about letting your application tell your translation management system what it needs, precisely when it needs it.
The Challenge of Manual Key Management
Traditionally, managing translation keys often involves a cycle of:
- Writing new UI text in your application.
- Manually creating a translation key (e.g.,
t('user.welcome_message')
). - Running an extraction tool (
i18next-cli
,i18next-parser
,i18next-scanner
) to find these keys in your source code. - Pushing these extracted keys to your translation management system (TMS).
- Waiting for human translators, or manually triggering machine translation, to fill in the missing values.
While robust, this process can introduce friction, especially in fast-paced development environments. It requires a distinct step for key extraction and often means translation files are out of sync with your live application.
Introducing saveMissing
: Keys When You Need Them
i18next's saveMissing
feature offers an elegant solution to this. When enabled in your i18next configuration, if your application attempts to translate a key that doesn't exist in your current language resources, i18next
won't just return the key itself. Instead, it will automatically inform a connected backend about this missing key.
This means you can simply use t('my.new.key', 'My default message')
in your code, and i18next, in conjunction with a compatible backend, will handle the rest. The key and its default value are sent to your translation service without any manual file creation or command-line extraction.
The Perfect Partner for saveMissing
For saveMissing
to work its magic, you need a backend that supports the create
functionâand this is where locize shines. By integrating i18next-locize-backend
into your project, any key your application requests that isn't yet present in locize is automatically added.
This creates a truly continuous localization workflow:
- Develop: Write your code, adding new
t()
calls as needed. - Run Application: As your application loads or users interact with new features, any missing translation keys are automatically detected and sent to your locize project.
- Real-time Updates: These keys appear in locize almost instantly, ready for translation.
This seamless integration ensures that your locize project always reflects the current state of your application's translation needs, reducing the overhead of manual key synchronization. To learn more about how saveMissing
and other features handle the complexities of missing translations, check out our blog post on Missing Translations.
The Power of AI Translation: From Missing to Translated in Seconds
The real game-changer comes when you combine saveMissing
with locize's automatic machine and AI translation workflow. Locize allows you to configure your project to automatically translate any newly added keys into your target languages using advanced machine translation or generative AI.
Hereâs how this powerful synergy works:
- You introduce a new translation key in your code (e.g.,
t('greeting.morning', 'Good morning!')
). - Your running application, configured with
saveMissing: true
andi18next-locize-backend
, sends this new key and its default value to locize. - Locize receives the key and, because you have the automatic translation workflow enabled, instantly translates "Good morning!" into all your configured target languages (e.g., German, French, Spanish) using AI.
- These machine-translated or AI-translated texts are then available immediately via locize's CDN, meaning your application can display the translated text almost as soon as you've typed the original.
This workflow is incredibly efficient for initial translation drafts, allowing you to quickly internationalize your application's UI. Human translators can then refine these AI-generated translations, focusing on nuance and quality rather than starting from scratch. We explored this hybrid approach further in our article, i18next, Locize, AI, and Human Translation: A Powerful Combo.
saveMissing
vs. i18next-cli
: Complementary, Not Conflicting
While i18next-cli extract
and other extraction tools perform a "pull" operation (scanning your code for keys), saveMissing
with locize performs a "push" operation (your app tells locize what's missing). Both have their strengths and ideal use cases:
i18next-cli extract
: Ideal for ensuring all keys in your codebase are accounted for, especially during a build process, catching stale keys, and generating type-safe translation files. It gives you a snapshot of your keys at a specific point in time.saveMissing
+ Locize (Dynamic Push): Perfect for rapid development, reducing friction, and ensuring that new content is immediately available for translation. It's a continuous, real-time approach.
In many robust localization pipelines, these two approaches can even complement each other. You might use saveMissing
during development for instant feedback and then use i18next-cli
(perhaps in a CI/CD pipeline) as a final validation step to catch any edge cases or identify unused keys for cleanup.
Get Started Today
Embracing the saveMissing
feature with locize's automatic translation workflow can dramatically accelerate your localization efforts and provide an unparalleled developer experience. It minimizes manual intervention, leverages the power of AI, and ensures your translations are always up-to-date.
To see this in action and set up your own project, explore the comprehensive tutorial on How to Easily Internationalize Your Software - Vite + React + TypeScript + i18next + locize.