Current Language Support
MetaMCP currently supports:- English (en) - Default language
- Chinese Simplified (zh) - Full translation available
Project Structure
The internationalization system is organized as follows:How It Works
URL Structure
MetaMCP uses locale-based routing:- English (default):
/mcp-servers
,/settings
,/namespaces
- Chinese:
/zh/mcp-servers
,/zh/settings
,/zh/namespaces
Middleware
Themiddleware.ts
file handles:
- Locale detection from URL, cookies, and Accept-Language header
- Automatic redirects to appropriate locale
- Authentication checks
Using Translations
Client Components
For client-side components, use theuseTranslations
hook:
Translation Key Format
Use colon-separated namespaces for organization:t('mcp-servers:server.create')
, t('mcp-servers:server.status.online')
Translation File Organization
Namespace Structure
Each translation namespace serves a specific purpose:common.json
common.json
Shared UI elements and general terms
auth.json
auth.json
Authentication-related text
navigation.json
navigation.json
mcp-servers.json
mcp-servers.json
MCP server-specific translations
Best Practices for Translation Keys
Translation Key Guidelines
- Use descriptive, hierarchical keys:
server.validation.nameRequired
- Use camelCase for consistency:
signIn
,mcpServers
- Group related translations: All server-related terms under
server
- Keep context clear:
auth:signIn
vsform:signIn
if different - Use interpolation for dynamic content:
"welcome": "Welcome, {{name}}!"
Adding New Languages
Step 1: Create Translation Files
-
Create language directory in
public/locales/
: -
Copy English files as templates:
-
Translate the content in each JSON file:
Step 2: Update Configuration
Add the new locale to your i18n configuration:Step 3: Update Language Switcher
The language switcher will automatically include new languages:Step 4: Test the Implementation
- Add test content in the new language
- Navigate to
/{locale}/
URLs (e.g.,/es/mcp-servers
) - Verify translations appear correctly
- Test language switching functionality
- Check fallbacks work for missing translations
Translation Workflow
For New Features
When adding new features to MetaMCP:- Add English translations first in appropriate namespace
- Use descriptive keys that make sense in context
- Test with English to ensure keys work correctly
- Add other languages (or mark for translation)
- Test all languages before deployment
For Contributors
Translation Contributors
Translation Contributors
To contribute translations:
- Fork the repository
- Create new language files or update existing ones
- Follow the existing key structure
- Test your translations locally
- Submit a Pull Request with your changes
- Keep translations concise but clear
- Maintain consistent terminology
- Consider cultural context, not just literal translation
- Test with longer text to ensure UI still works
AI-Assisted Translation
AI-Assisted Translation
Using AI tools like Cursor/Claude:
Troubleshooting
Common Issues
Missing Translations
Missing Translations
When translations don’t appear:
- Check the translation key exists in the JSON file
- Verify the namespace is correct (
common:save
vsauth:save
) - Ensure the locale file exists and is valid JSON
- Check browser console for missing key warnings
- Verify the component is using
useTranslations
correctly
Hydration Errors
Hydration Errors
Server/client translation mismatches:
- Ensure consistent locale detection between server and client
- Use the
isLoading
state fromuseTranslations
- Avoid rendering translations during SSR if locale might change
- Test with JavaScript disabled to check SSR behavior
Locale Routing Issues
Locale Routing Issues
URL routing problems:
- Check middleware configuration for new locales
- Verify
getLocalizedPath
function handles new languages - Test direct navigation to localized URLs
- Ensure fallback behavior works correctly
Debugging Tools
Future Enhancements
Planned Features
- RTL language support for Arabic, Hebrew
- Date/time localization with proper formatting
- Number formatting based on locale
- Currency formatting for pricing features
- Pluralization rules for complex language requirements
Contributing Guidelines
i18n Contributing Guidelines
- 📝 Add English first: Always start with English translations
- 🔍 Test thoroughly: Verify all locales work correctly
- 📊 Use consistent terminology: Maintain glossary for technical terms
- 🌍 Consider context: Adapt to cultural differences, not just language
- 📱 Test UI impact: Ensure longer translations don’t break layout
- 🤝 Collaborate: Work with native speakers when possible