feat: added command and models for pre-population of spanish content#1117
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new system for pre-computing and storing Spanish translations of content metadata, improving Algolia indexing performance by avoiding inline translation API calls. It adds a new
ContentTranslationmodel, migration, management command for batch translation, and updates the indexing logic to use pre-computed translations when available. The admin interface and utility functions are also updated to support these changes.Content Translation Model and Database Migration
ContentTranslationmodel to store pre-computed translations for eachContentMetadataobject, including translated fields, language code, and a source hash for change detection. Includes a migration to create this model and its indexes. [1] [2]Translation Management and Utilities
populate_spanish_translations.py) to batch-translate content metadata, store results inContentTranslation, and support options for force, batch size, language, and dry run.compute_source_hashutility function to detect changes in source content and avoid unnecessary re-translation.Algolia Indexing Pipeline Updates
ContentTranslationwhen available, falling back to inline translation only if necessary. The function signature forcreate_spanish_algolia_objectis updated to accept the source object for translation lookup. [1] [2] [3]Admin Interface Enhancements
ContentTranslationmodel in the Django admin with appropriate list, filter, and search fields for easier management and visibility. [1] [2]Logging Improvements
These changes together enable more efficient and reliable Spanish content indexing, with improved admin and operational support.
Post-review