Best Practices
Resource File Organization
It's recommended to organize resource files as follows:
Configure Multiple Namespaces:
Using Namespaces:
Error Handling
It's recommended to provide fallback options when resource loading fails:
Check Resource Loading State
When using SDK backend or need to ensure resources are loaded, use isResourcesReady from useModernI18n:
Alternative: Check i18next Initialization
For simpler cases, you can also check i18next initialization status:
Tip
isResourcesReady is more accurate for SDK backend scenarios as it checks if all required resources are actually loaded, not just if the instance is initialized.
Type Safety
Add type definitions for translation keys to improve development experience:
Using type-safe translations: