Skip to content

feat: construct and index Spanish Algolia objects for skills, jobs and industries#307

Open
rgopalrao-sonata-png wants to merge 2 commits into
openedx:masterfrom
rgopalrao-sonata-png:rgopalrao/11386
Open

feat: construct and index Spanish Algolia objects for skills, jobs and industries#307
rgopalrao-sonata-png wants to merge 2 commits into
openedx:masterfrom
rgopalrao-sonata-png:rgopalrao/11386

Conversation

@rgopalrao-sonata-png
Copy link
Copy Markdown
Contributor

JIRA: https://2u-internal.atlassian.net/browse/ENT-11386

Re-raises and rebases #286 onto the latest master.

Summary

Implements Spanish (and extensible multi-language) localization for the Algolia jobs index. For each enabled locale in TAXONOMY_TRANSLATION_LOCALES, a duplicate set of Algolia records is created with translated names and descriptions from the existing TaxonomyTranslation model. All records (English + localized) are indexed in a single atomic operation with zero downtime.

Key Changes

taxonomy/algolia/utils.py

  • build_name_translation_maps(language_code) — builds {English name → Translated name} dicts for jobs/skills/industries using one DB query per locale (O(1) lookup during translation)
  • translate_skill_dict, translate_industries_array, translate_job_record — translation helpers that preserve schema and fall back to English when no translation exists
  • create_localized_job_records — orchestrates building translation maps and producing localized job variants
  • index_jobs_data_in_algolia — loops over TAXONOMY_TRANSLATION_LOCALES, appends localized batches before the atomic Algolia write
  • fetch_jobs_data — stamps each English record with metadata_language: 'en'

taxonomy/algolia/constants.py

  • metadata_language added to Algolia searchable attributes and customRanking
  • TAXONOMY_TRANSLATION_LOCALES = ['es'] — add more ISO codes to enable additional languages, zero code changes needed

taxonomy/tests/test_algolia_translations.py (new, 519 lines)

  • 22 tests covering all new functions; all pass ✅

Version

  • 2.4.03.0.0

Merge Checklist

  • No new migrations required (uses existing TaxonomyTranslation model)
  • Version bumped (3.0.0)
  • Changelog updated
  • All 22 tests pass
  • Rebased on latest upstream/master (68c3f24)
  • Graceful fallback to English when translation is missing

Post Merge

  • Tag pushed and new version released
  • Verify 3.0.0 on PyPI
  • PR created in course-discovery to upgrade taxonomy-connector dependency

@marlonkeating marlonkeating self-assigned this May 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants