Skip to content

Dynamic Choice Detection in convert.py #2340

@abhijit9040

Description

@abhijit9040

The ConvertVars class in scripts/convert.py uses hardcoded lists to define valid languages and versions:

LANGUAGE_CHOICES = ["all", "en", "es", ...]
VERSION_CHOICES = ["all", "latest", "1.0", "1.1", ...]

This creates several issues:

  • Manual maintenance required whenever a new language or version is added.
  • Risk of inconsistency if new files are added to source/ but not reflected in the script.
  • Low discoverability, as contributors may not realize the script must also be updated.

Proposed Solution

  • Refactor ConvertVars to dynamically detect available editions, versions, and languages at runtime by scanning project directories.

Requirements

  • Scan source/ directory for .yaml files.
  • Extract metadata from filenames (edition-layout-version-language pattern) or from YAML meta blocks.
  • Populate choice lists dynamically during class initialization.
  • Preserve special logic for all and latest.

Files Involved

  • scripts/convert.py (specifically the ConvertVars class)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions