integration icon indicating copy to clipboard operation
integration copied to clipboard

feat: Add multilingual README support

Open rosch100 opened this issue 4 weeks ago • 3 comments

Add Multilingual README Support

Summary

This PR adds support for multilingual README files in HACS. Users will automatically see content in their Home Assistant language setting if available, with fallback to default English content.

Changes

  1. Multilingual README Support

    • Added async_get_info_file_contents_with_language() method
    • Supports README.{language_code}.md files (e.g., README.de.md, README.fr.md)
    • Automatic language detection with fallback to README.md
  2. Manifest Updates

    • Renamed supported_languages to content_languages in hacs.json manifest
    • Updated validator to use content_languages key
    • Validates language codes and checks for corresponding README files
  3. WebSocket Handler Updates

    • Extended hacs/repository/info to use language parameter for README content

Related PRs

  • Frontend PR: https://github.com/hacs/frontend/pull/XXX
  • Documentation PR: https://github.com/hacs/documentation/pull/660

Checklist

  • [x] Code follows project style guidelines
  • [x] Changes are backward compatible
  • [x] Code tested locally
  • [x] Validators updated
  • [x] WebSocket handlers updated

Notes

  • Repository maintainers can provide multilingual README files using README.{language_code}.md (e.g., README.de.md, README.fr.md)
  • Language codes must be 2-letter ISO 639-1 codes (e.g., de, fr, es)
  • The content_languages key in hacs.json can optionally declare supported languages for validation

rosch100 avatar Dec 01 '25 20:12 rosch100

All requested changes have been implemented:

supported_languages field added to hacs.json schema

  • Added supported_languages: list[str] = [] to HacsManifest class
  • Added _supported_languages_validator to validate ISO 639-1 language codes (2-letter codes)
  • Added supported_languages to HACS_MANIFEST_JSON_SCHEMA

Validation on repository registration and HACS action

  • Added validation in hacsjson.py to check if README files exist for all declared languages
  • Validates that README.{lang}.md files exist for each language in supported_languages
  • Runtime validation in async_get_info_file_contents_with_language to only use declared languages

Formatting issues fixed

  • Reset validate.py to main branch and only added the necessary _supported_languages_validator function
  • Only relevant changes in base.py and hacsjson.py (no unnecessary formatting changes)

All changes have been committed and pushed. Ready for review.

rosch100 avatar Dec 01 '25 20:12 rosch100

Hi @hacs/maintainers, could you please add the pr: enhancement label to this PR? This is a new feature implementation for multilingual README support. Thank you!

rosch100 avatar Dec 01 '25 21:12 rosch100

Hi @ludeeus,

All requested changes have been implemented and pushed. The code is ready for re-review.

rosch100 avatar Dec 02 '25 11:12 rosch100