-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
feat: Add multilingual README support #4965
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- Add optional language parameter to hacs/repository/info websocket command
- Implement async_get_info_file_contents_with_language method
- Support language-specific README files (README.{language}.md)
- Fallback to README.md if language-specific version not found
- Validate language codes (2-letter ISO 639-1)
- Fully backward compatible
- Add supported_languages field to HacsManifest class - Add _supported_languages_validator to validate ISO 639-1 language codes - Add supported_languages to HACS_MANIFEST_JSON_SCHEMA - Add validation in hacsjson.py to check if declared README files exist - Add runtime check in async_get_info_file_contents_with_language to only use declared languages - Fixes review comments from ludeeus
4f826be to
33e8da3
Compare
|
All requested changes have been implemented: ✅ supported_languages field added to hacs.json schema
✅ Validation on repository registration and HACS action
✅ Formatting issues fixed
All changes have been committed and pushed. Ready for review. |
|
Hi @hacs/maintainers, could you please add the |
- Extract base language code from BCP47 format (e.g., 'de-DE' -> 'de') - Keep supported_languages runtime check as per ludeeus requirement - All language processing logic now in backend
- Fix case combination mismatch: validator now checks same 6 combinations as runtime - Add language code format validation in validator (2-letter alphabetic) - Fix filename vs full_path inconsistency: use full_path consistently - Normalize supported_languages to lowercase when loading from manifest - Remove unnecessary comments
|
Hi @ludeeus, All requested changes have been implemented and pushed. The code is ready for re-review. |
- Add _supported_languages_validator to validate language codes - Add supported_languages to HACS_MANIFEST_JSON_SCHEMA as optional field - Validator handles None values and normalizes to lowercase - Remove unnecessary comment in websocket handler
- Add language code validation for string values in validator - Fix filename vs full_path inconsistency in hacsjson validator - Use filename instead of full_path for README file matching (consistent with information.py)
…o content_languages
- Add async_get_description_with_language() method to support multilingual descriptions
- Extend WebSocket handlers to use language parameter for descriptions
- Rename supported_languages to content_languages in manifest and validators
- Update validation to check content_languages for both README and description files
- Support DESCRIPTION.{language_code}.txt files with automatic language detection
- Remove async_get_description_with_language() method - Remove language parameter from hacs/repositories/list WebSocket command - Remove description language handling from hacs/repository/info - Update PR description to reflect README-only 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
async_get_info_file_contents_with_language()methodREADME.{language_code}.mdfiles (e.g.,README.de.md,README.fr.md)README.mdManifest Updates
supported_languagestocontent_languagesinhacs.jsonmanifestcontent_languageskeyWebSocket Handler Updates
hacs/repository/infoto use language parameter for README contentRelated PRs
Checklist
Notes
README.{language_code}.md(e.g.,README.de.md,README.fr.md)de,fr,es)content_languageskey inhacs.jsoncan optionally declare supported languages for validation