Going to production
Launching your app with Locize in production is fast and reliable, but there are a few critical steps to ensure security, performance, and a smooth workflow. Here’s what you need to know before going live:
1. Secure Your API Key
Never include your API key in your production build.
Exposing your API key in client-side code allows anyone to access or modify your translations at your expense.
- Fetching public translations from the CDN (using locizify, i18next-locize-backend, etc.) does not require an API key.
- You only need an API key for fetching private translations or when using saveMissing, add, or update features.
If your API key has been leaked, immediately remove it in your Locize project settings and update your codebase in the next deployment.
2. Use saveMissing, Add, and Update Only in Development
The saveMissing, add, and update features are designed for development and staging environments. Using them in production can generate unnecessary requests and may result in additional charges or account suspension.
If you enable these features, ensure the publish mode for the version is set to auto publish to avoid 412 errors.
3. Use last used Tracking Only in Development
The locize-lastused module and the used API endpoint should only be used during development. Using them in production can overload the service with unnecessary requests.
4. Load Translations from the Locize CDN
Loading translations from the Locize CDN offers several advantages:
- Realtime updates: Changes made in the Locize UI or API are instantly available via the CDN, saving time during development and production.
- No redeployments needed: Translators can fix typos or update content without requiring a new app deployment.
If you must load translations from your own server, consider using the CDN at least during development for real-time feedback.
5. Use Versions & Caching for Performance
For optimal performance in production:
- Create a dedicated version for production in your project settings.
- Enable caching on this version. This caches translations at edge locations, reducing latency and improving load times for users worldwide. Subsequent requests will also be cached by the browser.
-
Note: Configuring advanced caching (e.g., Cache-Control max-age) is only possible with the Pro CDN. See the caching documentation for details.
Production Launch Checklist
- API key is not exposed in production code
- saveMissing/add/update features disabled in production
- last used tracking disabled in production
- Translations loaded from Locize CDN
- Dedicated production version created
- Caching enabled (Pro CDN for advanced options)
By following these steps, you’ll ensure a secure, efficient, and maintainable localization workflow in production.