Localization
Here are the key patterns and best practices we follow for implementing localization (l10n) in our application.
Zod Schema Localization
The Problem with Hardcoded Messages
Avoid hardcoding error messages directly in your schemas:

This approach makes it difficult to support multiple languages and maintain consistent messaging across your application.
Best Practice: Schema Factory Pattern
Instead, use the Schema Factory Pattern. Create a schema factory function that accepts a translation function (t) to make your schemas reusable across different locales:

Implementation Example
❌ Don't create schemas with hardcoded messages:

✅ Do use the Schema Factory Pattern:
