feat: Add multilingual README support
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
-
Multilingual README Support
- Added
async_get_info_file_contents_with_language()method - Supports
README.{language_code}.mdfiles (e.g.,README.de.md,README.fr.md) - Automatic language detection with fallback to
README.md
- Added
-
Manifest Updates
- Renamed
supported_languagestocontent_languagesinhacs.jsonmanifest - Updated validator to use
content_languageskey - Validates language codes and checks for corresponding README files
- Renamed
-
WebSocket Handler Updates
- Extended
hacs/repository/infoto use language parameter for README content
- Extended
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_languageskey inhacs.jsoncan optionally declare supported languages for validation
All requested changes have been implemented:
✅ supported_languages field added to hacs.json schema
- Added
supported_languages: list[str] = []toHacsManifestclass - Added
_supported_languages_validatorto validate ISO 639-1 language codes (2-letter codes) - Added
supported_languagestoHACS_MANIFEST_JSON_SCHEMA
✅ Validation on repository registration and HACS action
- Added validation in
hacsjson.pyto check if README files exist for all declared languages - Validates that
README.{lang}.mdfiles exist for each language insupported_languages - Runtime validation in
async_get_info_file_contents_with_languageto only use declared languages
✅ Formatting issues fixed
- Reset
validate.pyto main branch and only added the necessary_supported_languages_validatorfunction - Only relevant changes in
base.pyandhacsjson.py(no unnecessary formatting changes)
All changes have been committed and pushed. Ready for review.
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!
Hi @ludeeus,
All requested changes have been implemented and pushed. The code is ready for re-review.