FAQ
Here are some common questions about using TranslateSheet.
1. What is the purpose of TranslateSheet?
TranslateSheet is designed to provide a better developer experience (DX) for managing and automating multilingual translations in React and React Native apps. It allows developers to define translations locally during development and generates consolidated translation files for production.
2. How does TranslateSheet work with i18next?
TranslateSheet works in parallel with i18next to handle runtime translations. During development, translations are defined locally using TranslateSheet.create()
. When you’re ready for production, running the gen-translations
command consolidates all translations into files that are loaded by i18next
at runtime.
For more details, see the Usage section.
3. Can I use TranslateSheet without AI translation?
Yes! While AI translation is a fully supported feature, you can still use TranslateSheet without it. If you prefer manual translations, simply run the translate-sheet push
command to send your translations strings to the TranslateSheet database.
From there, you can manually translate your strings and then use the translate-sheet pull
command to pull the translations back into your project.
4. Can I use the AI service without using TranslateSheet.create?
Yes, you can! While the AI-powered translation service is deeply integrated with TranslateSheet for a seamless development workflow, you can still use it without calling TranslateSheet.create()
.
If you prefer to manage translations manually, or already have a primary language file generated, you can call the AI translation service directly without using TranslateSheet.create()
during development.
- Generate an API key by visiting the TranslateSheet Dashboard .
- Ensure you have a
translateSheetConfig.js
file defined at the root of your project. - Ensure you have a primary language file (e.g.,
en.ts
). - Use the AI translation endpoint to translate the primary language content into target languages.
- Make a request to the AI translation endpoint with your content and target languages.
Run the command:
translate-sheet generate
with your API key and target languages specified in the configuration. This will automatically generate translated files for the specified target languages using the AI service.
{
"translatedContent": {
"greeting": "Hola",
"farewell": "Adiós"
}
}
This flexibility allows you to integrate AI translations into any existing localization system without requiring TranslateSheet for runtime usage.
5. How do I generate an API key for AI translation?
To generate an API key:
- Go to the TranslateSheet Dashboard .
- Sign up or log in with your account.
- Navigate to the API Keys section and click Generate New Key.
- Copy the generated API key and add it to your
translateSheetConfig.js
file.
For a step-by-step guide, see the Installation & Setup section.
6. Does TranslateSheet support hot reloading?
Yes, TranslateSheet supports hot reloading during development. This means you can see translation updates instantly without restarting your app, improving the speed of development.
7. What file formats are supported for the generated translation files?
TranslateSheet supports the following file formats:
- TypeScript (
.ts
) - JavaScript (
.js
) - JSON (
.json
)
You can specify the desired format using the fileExtension
option in your translateSheetConfig.js
file.
8. How do I handle missing translations?
If a translation key is missing, i18next
will fallback to the value specified in the defaultValue
field during initialization. You can also log missing keys by enabling debug mode in i18next
:
i18n.init({
debug: true,
fallbackLng: "en",
});
9. Can I use TranslateSheet with other localization libraries?
While TranslateSheet is designed to work seamlessly with i18next, you can use the generated translation files with other localization libraries that support JavaScript or JSON-based translations.
10. How do I add new languages after initial setup?
To add a new language:
- Update the
languages
array in yourtranslateSheetConfig.js
file to include the new language code. - Run the
gen-translations
command again to generate translation files for the new language.
11. Is there a way to manually edit generated translation files?
Yes, you can manually edit the generated files, but it’s recommended to keep your primary translations in the TranslateSheet.create()
objects within your components. This ensures that future runs of the gen-translations
command won’t overwrite manual edits.
12. How do I update translations in production?
- Make updates to your
TranslateSheet.create()
objects during development. - Run the
gen-translations
command to regenerate the consolidated translation files. - Deploy the updated files with your app.
13. Does TranslateSheet support plurals and complex string formatting?
Yes, since TranslateSheet works with i18next
, it supports all i18next
features, including plurals, genders, and custom formatting.
i18n.init({
interpolation: {
format: (value, format) => {
if (format === "uppercase") return value.toUpperCase();
return value;
},
},
});
Still Have Questions?
If you didn’t find the answer to your question here, feel free to visit the TranslateSheet Dashboard  or reach out through our support channels.