Skip to content

Conversation

@roomote
Copy link
Contributor

@roomote roomote bot commented Jul 30, 2025

This PR fixes hardcoded strings found during translation review of the Jina embedder implementation in PR #6416.

Issues Fixed

Hardcoded Strings in Jina Embedder

  • Line 107: "Base64/binary embeddings are not supported"t("embeddings:unsupportedEmbeddingFormat")
  • Line 265: "Unknown error"t("embeddings:unknownError")

Changes Made

1. Fixed Hardcoded Strings

  • Replaced hardcoded error messages with proper i18n function calls
  • Used existing unknownError translation key where available
  • Added new unsupportedEmbeddingFormat translation key

2. Added Missing Translations

  • Added unsupportedEmbeddingFormat translation to all 17 supported languages:
    • English, German, Spanish, French, Chinese (Simplified & Traditional)
    • Japanese, Italian, Portuguese (Brazil), Russian, Korean, Dutch
    • Polish, Turkish, Vietnamese, Hindi, Indonesian, Catalan
  • Added missing jinaConfigMissing translation to backend embeddings.json files

Translation Coverage

  • ✅ All UI text now uses i18n functions
  • ✅ New translation key added to all supported languages
  • ✅ No hardcoded user-facing strings remain

Related

Testing

  • ✅ All linting checks pass
  • ✅ All type checks pass
  • ✅ Translation script validation pending (requires remaining translations to be added)

Remaining Work

The translation check script still reports missing translations for:

  • Frontend Jina UI strings (jinaProvider, jinaApiKeyLabel, etc.) - these should be added in a separate PR focused on frontend translations
  • Some backend jinaConfigMissing keys in languages not yet updated

This PR focuses specifically on fixing the hardcoded strings found in the Jina embedder implementation.


Important

Internationalized hardcoded strings in Jina embedder and added support for Jina as an embedder provider with translations and configuration updates.

  • Internationalization:
    • Replaced hardcoded strings in Jina embedder with i18n function calls in jina.ts.
    • Added unsupportedEmbeddingFormat and unknownError translation keys.
    • Added translations for unsupportedEmbeddingFormat in 17 languages.
  • Jina Embedder Support:
    • Added Jina as an embedder provider in codebase-index.ts, config-manager.ts, and service-factory.ts.
    • Implemented JinaEmbedder class in jina.ts for embedding operations.
    • Updated webviewMessageHandler.ts to handle Jina API key storage.
  • UI and Configuration:
    • Updated CodeIndexPopover.tsx to include Jina provider options.
    • Added Jina API key validation and configuration in global-settings.ts.
    • Updated i18n files for UI text related to Jina configuration.

This description was created by Ellipsis for 612dd65. You can customize this summary. It will automatically update as commits are pushed.

Onnson and others added 2 commits July 30, 2025 09:25
- Add Jina to EmbedderProvider type and model profiles
- Implement JinaEmbedder class with multi-vector embeddings support
- Configure jina-embeddings-v4 model with code.query downstream task
- Add UI components for Jina provider selection and API key input
- Include proper error handling and rate limiting
- Add localization support for Jina-related messages
- Replace hardcoded "Base64/binary embeddings are not supported" with t("embeddings:unsupportedEmbeddingFormat")
- Replace hardcoded "Unknown error" with t("embeddings:unknownError")
- Add "unsupportedEmbeddingFormat" translation key to all supported languages
- Add missing "jinaConfigMissing" translation key to backend embeddings.json files

This fixes hardcoded strings that were found during translation review of the Jina embedder implementation.
@roomote roomote bot requested review from cte, jr and mrubens as code owners July 30, 2025 07:28
@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 30, 2025
Copy link
Contributor Author

@roomote roomote bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

This PR successfully internationalizes hardcoded strings in the Jina embedder and adds comprehensive Jina provider support. The implementation follows established patterns and maintains consistency with other embedding providers.

Critical Issues (Must Fix)

1. Missing jinaConfigMissing translation in Catalan

  • File: src/i18n/locales/ca/embeddings.json
  • The Catalan translation file is missing the jinaConfigMissing key that was added to German and English files
  • This will cause runtime errors when using Catalan locale with Jina provider

2. Incomplete Jina API key handling in UI secret status

  • File: webview-ui/src/components/chat/CodeIndexPopover.tsx (lines 288-335)
  • The secret status handler doesn't update codebaseIndexJinaApiKey field when receiving secret status updates
  • Other providers (OpenAI, Gemini, Mistral) properly handle their API key placeholders, but Jina is missing

Important Suggestions (Should Consider)

3. Inconsistent translation key placement

  • The new unsupportedEmbeddingFormat key appears at different line positions across language files
  • Consider maintaining consistent ordering for better maintainability

4. Enhanced error handling specificity

  • File: src/services/code-index/embedders/jina.ts (lines 264-268)
  • Could provide more specific error messages for different HTTP status codes beyond 401 and 429

Minor Improvements (Nice to Have)

5. Documentation consistency

  • Consider adding JSDoc comments to JinaEmbedder class methods for consistency with other embedder implementations

6. Translation validation

  • Verify all 17 supported languages have consistent translation keys and proper formatting

Positive Aspects

✅ Proper internationalization implementation using t() function calls
✅ Consistent integration with existing embedding provider patterns
✅ Comprehensive UI integration with validation and error handling
✅ Well-structured JinaEmbedder class with proper batching and rate limiting
✅ Appropriate model profiles and default configurations
✅ Clean type definitions and schema updates

The core functionality is solid and follows established patterns well. The critical issues should be addressed before merging to ensure proper functionality across all supported locales.

@hannesrudolph hannesrudolph added the Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. label Jul 30, 2025
roomote added 2 commits July 30, 2025 07:36
- Added jinaConfigMissing translation to 14 backend embeddings.json files
- Added Jina UI translations (provider, API key label/placeholder, validation) to Catalan frontend
- All backend translations now complete for Jina embedder
- Partial progress on frontend translations (Catalan complete, 16 languages remaining)
- Added Jina provider translations for 6 languages (ca, de, es, fr, ko, tr)
- Added validation translations for all 16 languages
- Partially completed remaining 10 languages (missing provider section keys)
- All hardcoded strings in Jina embedder properly use i18n functions
- Translation check script confirms backend translations are complete
@cte cte closed this Jul 30, 2025
@github-project-automation github-project-automation bot moved this from Triage to Done in Roo Code Roadmap Jul 30, 2025
@github-project-automation github-project-automation bot moved this from New to Done in Roo Code Roadmap Jul 30, 2025
@cte cte deleted the fix/jina-translation-hardcoded-strings branch July 30, 2025 07:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Issue/PR - Triage New issue. Needs quick review to confirm validity and assign labels. size:L This PR changes 100-499 lines, ignoring generated files.

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

5 participants