-
-
Notifications
You must be signed in to change notification settings - Fork 112
Add Multilingual README Support #891
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 language code extraction from BCP47 format - Implement automatic language detection based on hass.language - Add backend support detection with intelligent caching - Update repository dashboard and download dialog to pass language - Add automatic reload when language changes - Fully backward compatible with graceful degradation - Add comprehensive documentation and testing guides Related backend PR: hacs/integration#4964
- Fix race condition in backendSupportsLanguage cache: Add promise-based synchronization to prevent concurrent requests from corrupting the cache state. Only set cache if still null to protect against race conditions. - Fix false language change detection: Only refetch repository when oldHass exists and language actually changed, preventing unnecessary API calls on initial property changes. Fixes issues where: 1. Concurrent requests with different languages could corrupt the cache 2. Repository was refetched unnecessarily when oldHass was undefined
…ort it When waiting for a concurrent backend support check, if the backend rejects the language parameter, the code now explicitly removes it from the message object using delete message.language. This prevents the parameter from being sent anyway, which would cause repeated backend errors. Fixes race condition where concurrent requests could leave language parameter in message even after discovering backend doesn't support it.
Ignore debug documentation and test scripts used during development: - DEBUG_WEBSOCKET.md - SAFARI_WEBSOCKET_DEBUGGING.md - test-multilingual-readme.js
When a concurrent request waits for another request's backend support check to complete, if the cache is still null after waiting (indicating the previous request encountered a non-language-related error or didn't complete properly), the code now attempts its own backend support check instead of skipping the language parameter entirely. This prevents a scenario where all concurrent requests give up on determining backend support, causing the cache to never be set and all requests to skip the language parameter regardless of backend capability. Fixes issue where concurrent requests could leave cache in null state permanently if first request failed with non-language-related error.
When waiting for a concurrent backend support check to complete, if the cache is set to true or false, the code was modifying the message object but then falling through to line 223 where it would send a duplicate request. This resulted in sending two requests when only one was needed. Fix: After waiting for concurrent check and setting message based on cache state (true or false), immediately send the request and return, preventing the code from falling through to the final request sending code at line 235. This ensures that: - If cache is true after waiting: send request with language parameter and return - If cache is false after waiting: send request without language parameter and return - If cache is still null after waiting: proceed with our own check (existing logic)
📝 WalkthroughWalkthroughThis pull request introduces multilingual README support for HACS. The feature enables frontend language-aware repository info retrieval with automatic backend capability detection, graceful degradation for unsupported backends, and language-change-triggered re-fetching. It includes comprehensive documentation, implementation guides, and testing procedures alongside core frontend changes. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Frontend as Frontend<br/>(Dashboard/Dialog)
participant DataLayer as Data Layer<br/>(repository.ts)
participant Backend as Backend<br/>(WebSocket)
User->>Frontend: Navigate or change language
activate Frontend
Frontend->>DataLayer: fetchRepositoryInformation(hass, repoId, hass.language)
deactivate Frontend
activate DataLayer
alt Backend support unknown
DataLayer->>DataLayer: Extract base language code
alt Base language not "en"
DataLayer->>Backend: Send language parameter in request
activate Backend
alt Backend supports language
Backend-->>DataLayer: Success (language recognized)
DataLayer->>DataLayer: Cache: backend supports language
else Backend rejects language
Backend-->>DataLayer: Error/rejection
deactivate Backend
DataLayer->>DataLayer: Cache: backend does NOT support language
DataLayer->>Backend: Retry without language parameter
activate Backend
Backend-->>DataLayer: Repository info (default README)
end
else Base language is "en"
DataLayer->>Backend: Send request without language parameter
activate Backend
Backend-->>DataLayer: Repository info (default README)
end
else Backend support cached (supports)
DataLayer->>Backend: Send with language parameter
activate Backend
Backend-->>DataLayer: Language-specific README if available
else Backend support cached (does NOT support)
DataLayer->>Backend: Send without language parameter
activate Backend
Backend-->>DataLayer: Default README
end
deactivate Backend
DataLayer-->>Frontend: RepositoryInfo with selected README
deactivate DataLayer
activate Frontend
Frontend->>User: Render multilingual README
deactivate Frontend
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Areas requiring extra attention:
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hi @hacs/maintainers, This PR adds multilingual README support to HACS, which is a new feature. Could you please add the The PR is currently showing "action required" status in the GitHub Actions workflow. I'm not sure if this is related to missing labels or if there's another issue. Any guidance would be appreciated. Thank you! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
src/data/repository.ts (1)
124-242: LGTM! Complex but well-implemented backend capability detection.The implementation correctly handles all the edge cases and bug fixes mentioned in the PR:
- ✅ Race condition protection via promise-based synchronization
- ✅ Explicit
delete message.languagewhen backend doesn't support it (bug fix #3)- ✅ Early returns after concurrent check to prevent duplicate requests (bug fix #5)
- ✅ Fallback check when cache is still null after waiting (bug fix #4)
- ✅ Proper error handling with retry logic for unsupported backend
The control flow is complex but necessary to achieve graceful degradation and backend compatibility detection.
Optional: Consider using a proper logging mechanism.
The current implementation uses
console.logstatements throughout for debugging. While helpful during development, consider using a configurable logging utility (if available) for production-ready code, allowing log levels to be controlled.Example:
-console.log(`[HACS] Sending language parameter: "${baseLanguage}" (backend supports it)`); +// Use a proper logger if available +this.logger?.debug(`[HACS] Sending language parameter: "${baseLanguage}" (backend supports it)`);However, if console logging is the standard approach in this codebase, the current implementation is acceptable.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
Cache: Disabled due to data retention organization setting
Knowledge base: Disabled due to data retention organization setting
📒 Files selected for processing (8)
.gitignore(1 hunks)BACKEND_IMPLEMENTATION_GUIDE.md(1 hunks)HACS_MULTILINGUAL_FEATURE_REQUEST.md(1 hunks)PULL_REQUEST.md(1 hunks)TESTING_MULTILINGUAL_README.md(1 hunks)src/components/dialogs/hacs-download-dialog.ts(1 hunks)src/dashboards/hacs-repository-dashboard.ts(1 hunks)src/data/repository.ts(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/dialogs/hacs-download-dialog.ts (3)
src/data/repository.ts (5)
RepositoryInfo(76-85)RepositoryBase(47-74)fetchRepositoryInformation(104-243)repositoryDownloadVersion(245-254)repositoryReleases(256-262)src/components/dialogs/show-hacs-dialog.ts (1)
HacsDownloadDialogParams(27-30)src/tools/frontend-resource.ts (1)
generateFrontendResourceURL(3-7)
🪛 Biome (2.1.2)
src/components/dialogs/hacs-download-dialog.ts
[error] 331-331: href is assigned to itself.
This is where is assigned.
Self assignments have no effect and can be removed.
(lint/correctness/noSelfAssign)
🪛 LanguageTool
TESTING_MULTILINGUAL_README.md
[grammar] ~7-~7: Ergänze ein Satzzeichen
Context: ...n können. ## Voraussetzungen 1. HACS Frontend Repository mit den Änderungen...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_HACSDASHFRONTENDDASHREPOSITORY)
[grammar] ~7-~7: Ergänze ein Satzzeichen
Context: ... ## Voraussetzungen 1. HACS Frontend Repository mit den Änderungen aus dem ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_HACSDASHFRONTENDDASHREPOSITORY)
[grammar] ~8-~8: Ergänze ein Satzzeichen
Context: ... feature/Multilingual-readme 2. HACS Backend Integration (muss den `languag...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_HACSDASHBACKENDDASHINTEGRATION)
[grammar] ~8-~8: Ergänze ein Satzzeichen
Context: ...e/Multilingual-readme2. **HACS Backend Integration** (muss denlanguage`-Param...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_HACSDASHBACKENDDASHINTEGRATION)
[grammar] ~9-~9: Ergänze ein Satzzeichen
Context: ...repository/info` unterstützen) 3. Home Assistant Instanz mit HACS installiert...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_HOMEDASHASSISTANTDASHINSTANZ)
[grammar] ~9-~9: Ergänze ein Satzzeichen
Context: .../info` unterstützen) 3. Home Assistant Instanz mit HACS installiert 4. **Test...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_HOMEDASHASSISTANTDASHINSTANZ)
[grammar] ~14-~14: Wähle ein passenderes Wort
Context: ...tion ### Test der getBaseLanguageCode Funktion Erstellen Sie eine Testdatei o...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_NOUN)
[grammar] ~55-~55: Ergänze ein Satzzeichen
Context: ... 1. Öffnen Sie Home Assistant in Ihrem Browser 2. Navigieren Sie zu HACS 3. Öffnen Sie...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~56-~56: Ergänze ein Satzzeichen
Context: ...t in Ihrem Browser 2. Navigieren Sie zu HACS 3. Öffnen Sie die Browser-Entwicklertoo...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~57-~57: Hier könnte ein Fehler sein.
Context: ...en Sie die Browser-Entwicklertools (F12) ### Schritt 3: Websocket-Nachrichten überwac...
(QB_NEW_DE)
[grammar] ~83-~83: Passe das Symbol an
Context: ...u Einstellungen → Sprache & Region 2. Ändern Sie die Sprache (z.B. von Englisc...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~84-~84: Passe das Symbol an
Context: ...e Sprache (z.B. von Englisch zu Deutsch) 3. Navigieren Sie zurück zu HACS 4. Öffnen ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~85-~85: Passe das Symbol an
Context: ...eutsch) 3. Navigieren Sie zurück zu HACS 4. Öffnen Sie ein Repository mit mehrsprach...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~86-~86: Hier könnte ein Fehler sein.
Context: ...sitory mit mehrsprachigen README-Dateien ### Schritt 5: Repository-Informationen prüf...
(QB_NEW_DE)
[grammar] ~90-~90: Ergänze ein Satzzeichen
Context: ...prüfen 1. Öffnen Sie ein Repository in HACS 2. Prüfen Sie in der Browser-Konsole, o...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~91-~91: Ergänze ein Satzzeichen
Context: ...e richtige Websocket-Nachricht gesendet wurde 3. Prüfen Sie, ob die README in der ric...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~92-~92: Hier könnte ein Fehler sein.
Context: ... in der richtigen Sprache angezeigt wird ## 3. Test mit verschiedenen Sprachen ### ...
(QB_NEW_DE)
[grammar] ~96-~96: Wähle ein passenderes Wort
Context: ...3. Test mit verschiedenen Sprachen ### Test-Szenarien | Home Assistant Sprache | Erwartete REA...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_NOUN)
[grammar] ~118-~118: Ergänze ein Leerzeichen
Context: ... Datei sollte eindeutigen Inhalt haben, z.B.: README.md: ```markdown # Test R...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_ORTHOGRAPHY_SPACE)
[grammar] ~143-~143: Wähle ein passenderes Wort
Context: ...s. ``` ## 4. Automatisierte Tests ### Test-Datei erstellen Erstellen Sie `src/data/__te...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_NOUN)
[grammar] ~219-~219: Passe die Wortendung an
Context: ... ## 5. Integrationstests ### Test mit echten Home Assistant Instanz 1. **HACS Backe...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_ADJECTIVE_FORM)
[grammar] ~219-~219: Passe die Wortendung an
Context: ...egrationstests ### Test mit echten Home Assistant Instanz 1. **HACS Backend akt...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_ADJECTIVE_FORM)
[grammar] ~219-~219: Passe die Wortendung an
Context: ...ests ### Test mit echten Home Assistant Instanz 1. **HACS Backend aktualisieren...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_ADJECTIVE_FORM)
[grammar] ~221-~221: Ergänze ein Satzzeichen
Context: ...echten Home Assistant Instanz 1. HACS Backend aktualisieren: Stellen Sie sic...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_HACSDASHBACKEND)
[grammar] ~232-~232: Ergänze ein Satzzeichen
Context: ...erwenden 1. Öffnen Sie die Netzwerk-Registerkarte 2. Filtern Sie nach WS (WebSocket) ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~233-~233: Ergänze ein Satzzeichen
Context: ...gisterkarte 2. Filtern Sie nach WS (WebSocket) 3. Öffnen Sie ein Repository in HACS 4....
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~234-~234: Ergänze ein Satzzeichen
Context: ...Socket) 3. Öffnen Sie ein Repository in HACS 4. Prüfen Sie die gesendeten Nachrichte...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~235-~235: Hier könnte ein Fehler sein.
Context: ...4. Prüfen Sie die gesendeten Nachrichten ## 6. Edge Cases testen ### Test-Szenarien...
(QB_NEW_DE)
[style] ~237-~237: Bei bestimmten Textarten und Formulierungen bietet es sich an, eine deutschsprachige Alternative zu benutzen.
Context: ...n Sie die gesendeten Nachrichten ## 6. Edge Cases testen ### Test-Szenarien für Edge Cas...
(ALTERNATIVEN_FUER_ANGLIZISMEN)
[style] ~239-~239: Bei bestimmten Textarten und Formulierungen bietet es sich an, eine deutschsprachige Alternative zu benutzen.
Context: ...ge Cases testen ### Test-Szenarien für Edge Cases 1. **Sprache ändern während Repository...
(ALTERNATIVEN_FUER_ANGLIZISMEN)
[grammar] ~241-~241: Ergänze ein Satzzeichen
Context: ...-Szenarien für Edge Cases 1. Sprache ändern während Repository geöffnet ist - ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_COMMA)
[grammar] ~242-~242: Ergänze ein Satzzeichen
Context: ...tory geöffnet ist** - Öffnen Sie ein Repository - Ändern Sie die Sprache in Home Ass...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~243-~243: Ergänze ein Satzzeichen
Context: ...ory - Ändern Sie die Sprache in Home Assistant - Prüfen Sie, ob die README automati...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~244-~244: Hier könnte ein Fehler sein.
Context: ... die README automatisch neu geladen wird 2. **Repository ohne sprachspezifische README...
(QB_NEW_DE)
[grammar] ~315-~315: Ergänze ein Satzzeichen
Context: ...ob das Backend den language-Parameter unterstützt 2. Prüfen Sie die Browser-Konsole auf F...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~316-~316: Ergänze ein Satzzeichen
Context: ...t 2. Prüfen Sie die Browser-Konsole auf Fehler 3. Prüfen Sie, ob die sprachspezifische...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~317-~317: Hier könnte ein Fehler sein.
Context: ...che README-Datei im Repository existiert ### Problem: Sprache wird nicht neu geladen ...
(QB_NEW_DE)
[grammar] ~322-~322: Ergänze ein Satzzeichen
Context: ...ository-Dashboard korrekt implementiert ist 2. Prüfen Sie, ob hass.language sich ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~323-~323: Ergänze ein Satzzeichen
Context: ...ie, ob hass.language sich tatsächlich ändert 3. Laden Sie die Seite neu, nachdem Sie...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~324-~324: Hier könnte ein Fehler sein.
Context: ..., nachdem Sie die Sprache geändert haben ## 10. Nützliche Befehle ```bash # Fronten...
(QB_NEW_DE)
[grammar] ~347-~347: Ergänze ein Satzzeichen
Context: ...heck ``` ## Weitere Ressourcen - [HACS Frontend Dokumentation](https://hacs.xyz...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_HACSDASHFRONTENDDASHDOKUMENTATION)
[grammar] ~347-~347: Ergänze ein Satzzeichen
Context: ... ## Weitere Ressourcen - [HACS Frontend Dokumentation](https://hacs.xyz/docs/con...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_HACSDASHFRONTENDDASHDOKUMENTATION)
[grammar] ~348-~348: Entferne ein Leerzeichen
Context: ...s.xyz/docs/contribute/frontend/) - [Home Assistant Frontend Entwickler-Dokumentat...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_ORTHOGRAPHY_SPACE)
[grammar] ~348-~348: Entferne ein Leerzeichen
Context: .../contribute/frontend/) - [Home Assistant Frontend Entwickler-Dokumentation](https...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_ORTHOGRAPHY_SPACE)
[grammar] ~348-~348: Entferne ein Leerzeichen
Context: ...te/frontend/) - [Home Assistant Frontend Entwickler-Dokumentation](https://develo...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_ORTHOGRAPHY_SPACE)
[grammar] ~349-~349: Ergänze ein Satzzeichen
Context: ...me-assistant.io/docs/frontend/) - [BCP47 Sprachcodes](https://en.wikipedia.org/wi...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_BCP47DASHSPRACHCODES)
HACS_MULTILINGUAL_FEATURE_REQUEST.md
[grammar] ~9-~9: Use a hyphen to join words.
Context: .... This creates a barrier for non-English speaking users who may not understand th...
(QB_NEW_EN_HYPHEN)
[style] ~155-~155: ‘with reference to’ might be wordy. Consider a shorter alternative.
Context: ...ADME rendering 4. Create a Pull Request with reference to this feature request **Option 3: Issue...
(EN_WORDINESS_PREMIUM_WITH_REFERENCE_TO)
BACKEND_IMPLEMENTATION_GUIDE.md
[grammar] ~1-~1: Ersetze das Satzzeichen
Context: ...end: Mehrsprachige README-Unterstützung - Implementierungsanleitung ## Übersicht...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~5-~5: Ergänze ein Satzzeichen
Context: ...e Dokumentation beschreibt, wie das HACS Backend erweitert werden muss, um mehrsp...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_HACSDASHBACKEND)
[grammar] ~9-~9: Hier könnte ein Fehler sein.
Context: ...sitory/info`. ## Backend-Repository Repository: https://github.com/hacs/integration ...
(QB_NEW_DE)
[grammar] ~9-~9: Ergänze ein Leerzeichen
Context: ... ## Backend-Repository Repository: https://github.com/hacs/integration ## ...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_ORTHOGRAPHY_SPACE)
[grammar] ~9-~9: Hier könnte ein Fehler sein.
Context: ...y:** https://github.com/hacs/integration ## Frontend-Implementierung (bereits fertig...
(QB_NEW_DE)
[grammar] ~24-~24: Ergänze das fehlende Element
Context: ...arameter ist optional und backward-kompatibel - Format: Basis-Sprachcode (z.B. "de"...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_OTHER)
[grammar] ~25-~25: Ersetze das Satzzeichen
Context: ...ibel** - Format: Basis-Sprachcode (z.B. "de" aus "de-DE", "en" aus "en-US") - Wird n...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_L_DOUBLE_QUOT)
[grammar] ~25-~25: Ersetze das Satzzeichen
Context: ...Format: Basis-Sprachcode (z.B. "de" aus "de-DE", "en" aus "en-US") - Wird nur gesen...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_„)
[grammar] ~25-~25: Ersetze das Satzzeichen
Context: ...at: Basis-Sprachcode (z.B. "de" aus "de-DE", "en" aus "en-US") - Wird nur gesendet,...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_L_DOUBLE_QUOT)
[grammar] ~25-~25: Ersetze das Satzzeichen
Context: ...asis-Sprachcode (z.B. "de" aus "de-DE", "en" aus "en-US") - Wird nur gesendet, wenn ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_„)
[grammar] ~25-~25: Ersetze das Satzzeichen
Context: ...chcode (z.B. "de" aus "de-DE", "en" aus "en-US") - Wird nur gesendet, wenn die Spra...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_„)
[grammar] ~25-~25: Ersetze das Satzzeichen
Context: ...de (z.B. "de" aus "de-DE", "en" aus "en-US") - Wird nur gesendet, wenn die Sprache n...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_L_DOUBLE_QUOT)
[grammar] ~26-~26: Ergänze ein Satzzeichen
Context: ...Englisch ist (Englisch verwendet README.md) - Das Frontend hat automatische Fehlerb...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~27-~27: Hier könnte ein Fehler sein.
Context: ...rd die Anfrage ohne Parameter wiederholt ## Backend-Implementierung ### 1. Websocke...
(QB_NEW_DE)
[grammar] ~33-~33: Hier könnte ein Fehler sein.
Context: ...g ### 1. Websocket-Handler anpassen Datei: hacs/websocket/repository/info.py (...
(QB_NEW_DE)
[grammar] ~33-~33: Ergänze ein Leerzeichen
Context: .... Websocket-Handler anpassen Datei: hacs/websocket/repository/info.py (ode...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_ORTHOGRAPHY_SPACE)
[grammar] ~33-~33: Ergänze ein Wort
Context: ... Websocket-Handler anpassen Datei: hacs/websocket/repository/info.py (oder ähnlich) **Aktueller Code (Beisp...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_NOUN)
[grammar] ~246-~246: Hier könnte ein Fehler sein.
Context: ...DME-Dateien unterstützen: - README.md - Standard-README (Englisch oder Fallbac...
(QB_NEW_DE)
[grammar] ~246-~246: Ersetze das Satzzeichen
Context: ...ME-Dateien unterstützen: - README.md - Standard-README (Englisch oder Fallback...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_DASH_–)
[grammar] ~246-~246: Entferne das Symbol
Context: ...Standard-README (Englisch oder Fallback) - README.de.md - Deutsch - README.fr.md - Französisch ...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_OTHER)
[grammar] ~247-~247: Passe das Symbol an
Context: ...der Fallback) - README.de.md - Deutsch - README.fr.md - Französisch - README.es.md - Spanisch...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~248-~248: Entferne das Symbol
Context: ...- Deutsch - README.fr.md - Französisch - README.es.md - Spanisch - README.it.md - Italienisch...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_OTHER)
[grammar] ~249-~249: Entferne das Symbol
Context: ... Französisch - README.es.md - Spanisch - README.it.md - Italienisch - README.nl.md - Niederlä...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_OTHER)
[grammar] ~250-~250: Entferne das Symbol
Context: ... Spanisch - README.it.md - Italienisch - README.nl.md - Niederländisch - README.pl.md - Polni...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_OTHER)
[grammar] ~251-~251: Entferne das Symbol
Context: ...enisch - README.nl.md - Niederländisch - README.pl.md - Polnisch - README.pt.md - Portugiesis...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_OTHER)
[grammar] ~252-~252: Entferne das Symbol
Context: ...ederländisch - README.pl.md - Polnisch - README.pt.md - Portugiesisch - README.ru.md - Russis...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_OTHER)
[grammar] ~253-~253: Entferne das Symbol
Context: ...olnisch - README.pt.md - Portugiesisch - README.ru.md - Russisch - README.zh.md - Chinesisch ...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_OTHER)
[grammar] ~254-~254: Entferne das Symbol
Context: ...ortugiesisch - README.ru.md - Russisch - README.zh.md - Chinesisch - etc. Format: `README....
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_OTHER)
[grammar] ~255-~255: Entferne ein Leerzeichen
Context: ...- Russisch - README.zh.md - Chinesisch - etc. Format: `README.{language_code...
(QB_NEW_DE_OTHER_ERROR_IDS_UNNECESSARY_ORTHOGRAPHY_SPACE)
[grammar] ~258-~258: Hier könnte ein Fehler sein.
Context: ...- README.zh.md - Chinesisch - etc. Format: README.{language_code}.md (ISO 639-...
(QB_NEW_DE)
[grammar] ~258-~258: Ergänze ein Leerzeichen
Context: ....zh.md- Chinesisch - etc. **Format:**README.{language_code}.md` (ISO 639-1 S...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_ORTHOGRAPHY_SPACE)
[grammar] ~258-~258: Ergänze ein Wort
Context: ...zh.md- Chinesisch - etc. **Format:**README.{language_code}.md` (ISO 639-1 Sprachcode, 2 Buchstaben) #...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_NOUN)
[grammar] ~262-~262: Passe das Symbol an
Context: ...Fallback-Verhalten 1. Wenn language Parameter gesendet wird: - Versuche...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~262-~262: Ergänze ein Satzzeichen
Context: ...Wenn language Parameter gesendet wird:** - Versuche README.{language}.md zu laden - Fa...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_COMMA)
[grammar] ~263-~263: Ergänze ein Satzzeichen
Context: ... - Versuche README.{language}.md zu laden - Falls nicht vorhanden, verwende `R...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_PUNCTUATION_PERIOD)
[grammar] ~264-~264: Hier könnte ein Fehler sein.
Context: ...anden, verwende README.md als Fallback 2. **Wenn kein language Parameter gesendet ...
(QB_NEW_DE)
[grammar] ~266-~266: Passe das Symbol an
Context: ... als Fallback 2. Wenn kein language Parameter gesendet wird: - Verwende...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~267-~267: Wähle ein passenderes Wort
Context: ...ndet wird:** - Verwende README.md (Standard-Verhalten, backward-kompatibel) 3. **Wenn `langu...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_NOUN)
[grammar] ~269-~269: Ersetze das Satzzeichen
Context: ...ard-kompatibel) 3. Wenn language = "en" oder None: - Verwende README.md ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_QUOTE_„)
[grammar] ~269-~269: Passe das Symbol an
Context: ... 3. Wenn language = "en" oder None: - Verwende README.md (Englisch ist die S...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~270-~270: Wähle ein passenderes Wort
Context: ... Verwende README.md (Englisch ist die Standard-Sprache) ## Validierung Der language-Parame...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_NOUN)
[grammar] ~270-~270: Hier könnte ein Fehler sein.
Context: ....md(Englisch ist die Standard-Sprache) ## Validierung Derlanguage`-Parameter so...
(QB_NEW_DE)
[grammar] ~289-~289: Wähle ein passenderes Wort
Context: ...zu Kleinbuchstaben ``` ## Testing ### Test-Szenarien 1. Repository mit nur README.md: - Req...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_NOUN)
[grammar] ~330-~330: Passe das Symbol an
Context: ... und Backward-Kompatibilität Wichtig: Die Implementierung muss **vollständig ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~332-~332: Passe das Symbol an
Context: ...arameter) müssen weiterhin funktionieren - Neue Frontend-Versionen (mit language-...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~333-~333: Hier könnte ein Fehler sein.
Context: ...erstützt (Frontend hat Fehlerbehandlung) Empfehlung: - Der language-Parameter...
(QB_NEW_DE)
[grammar] ~336-~336: Füge ein passenderes Wort ein
Context: ...* - Der language-Parameter sollte als vol.Optional() definiert werden - Wenn der Parameter n...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_VERB)
[grammar] ~336-~336: Füge ein passenderes Wort ein
Context: ...-Parameter sollte als vol.Optional()` definiert werden - Wenn der Parameter nicht vorhanden is...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_VERB)
[grammar] ~337-~337: Wähle ein passenderes Wort
Context: ...rameter nicht vorhanden ist, sollte das Standard-Verhalten (README.md) verwendet werden ## Beispi...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_NOUN)
[grammar] ~337-~337: Hier könnte ein Fehler sein.
Context: ...d-Verhalten (README.md) verwendet werden ## Beispiel-Repository Ein Beispiel-Reposi...
(QB_NEW_DE)
[grammar] ~353-~353: Ersetze das Satzzeichen
Context: ...sammenfassung Was muss implementiert werden: 1. ✅ Websocket-Handler erweitern: `vol.Opti...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_COLON_QUESTION_MARK)
[grammar] ~355-~355: Ersetze das Satzzeichen
Context: ...n:** 1. ✅ Websocket-Handler erweitern: vol.Optional("language"): str hinzufügen 2. ✅ README-Lade-Funk...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_PUNCTUATION_OPTIONALOPEN_PARENTHESISQUOTELANGUAGEQUOTE_OPTIONALOPEN_PARENTHESIS„LANGUAGEL_DOUBLE_QUOT)
[grammar] ~371-~371: Hier könnte ein Fehler sein.
Context: ...on) ## Weitere Ressourcen - Frontend-Repository: https://github.com/hacs/frontend - **...
(QB_NEW_DE)
[grammar] ~371-~371: Ergänze ein Leerzeichen
Context: ...e Ressourcen - Frontend-Repository: https://github.com/hacs/frontend - **Bac...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_ORTHOGRAPHY_SPACE)
[grammar] ~371-~371: Passe das Symbol an
Context: ...tory:** https://github.com/hacs/frontend - Backend-Repository: https://github.com...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~372-~372: Hier könnte ein Fehler sein.
Context: ...s://github.com/hacs/frontend - Backend-Repository: https://github.com/hacs/integration -...
(QB_NEW_DE)
[grammar] ~372-~372: Ergänze ein Leerzeichen
Context: .../hacs/frontend - Backend-Repository: https://github.com/hacs/integration - **...
(QB_NEW_DE_OTHER_ERROR_IDS_MISSING_ORTHOGRAPHY_SPACE)
[grammar] ~372-~372: Passe das Symbol an
Context: ...y:** https://github.com/hacs/integration - HACS Dokumentation: https://hacs.xyz/d...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~373-~373: Passe das Symbol an
Context: ...s://github.com/hacs/integration - HACS Dokumentation: https://hacs.xyz/docs/ ...
(QB_NEW_DE_OTHER_ERROR_IDS_REPLACEMENT_OTHER)
[grammar] ~373-~373: Hier könnte ein Fehler sein.
Context: ...s/integration - HACS Dokumentation: https://hacs.xyz/docs/ ## Fragen oder Probleme? Bei Fragen zur Im...
(QB_NEW_DE)
PULL_REQUEST.md
[style] ~107-~107: Consider using “outdated” to strengthen your wording.
Context: ...t Backward Compatibility:** - Use an old backend version (without language par...
(OLD_VERSION)
🪛 markdownlint-cli2 (0.18.1)
TESTING_MULTILINGUAL_README.md
10-10: Bare URL used
(MD034, no-bare-urls)
193-193: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
HACS_MULTILINGUAL_FEATURE_REQUEST.md
10-10: Bare URL used
(MD034, no-bare-urls)
PULL_REQUEST.md
10-10: Bare URL used
(MD034, no-bare-urls)
193-193: Emphasis used instead of a heading
(MD036, no-emphasis-as-heading)
🔇 Additional comments (11)
.gitignore (1)
14-18: LGTM!The additions appropriately ignore debug and test files related to multilingual README development. The comment clearly documents the purpose of these entries.
BACKEND_IMPLEMENTATION_GUIDE.md (1)
1-381: LGTM!This comprehensive backend implementation guide provides clear instructions, code examples, and testing scenarios for implementing multilingual README support. The documentation covers all essential aspects including WebSocket handler modifications, fallback logic, validation, and backward compatibility.
HACS_MULTILINGUAL_FEATURE_REQUEST.md (1)
1-163: LGTM!This feature request document is well-structured and provides clear motivation, proposed solution, and implementation details for multilingual README support. The alignment with Home Assistant's existing i18n approach ensures consistency with the platform's standards.
TESTING_MULTILINGUAL_README.md (1)
1-350: LGTM!This comprehensive testing guide provides detailed procedures for unit tests, manual browser testing, integration tests, and edge cases. The inclusion of debugging tips, checklists, and known issues with solutions makes this a valuable resource for testing the multilingual README feature.
src/components/dialogs/hacs-download-dialog.ts (1)
148-158: LGTM!The addition of
this.hass.languageparameter enables multilingual README support in the download dialog, consistent with the updatedfetchRepositoryInformationsignature. This change properly integrates with the language-aware data fetching mechanism.src/dashboards/hacs-repository-dashboard.ts (2)
144-158: LGTM!The language change detection logic correctly handles the edge case where
oldHassmight be undefined (first property change), preventing unnecessary API calls. The implementation only refetches repository information when the language actually changes, which is efficient and user-friendly.
160-170: LGTM!The addition of
this.hass.languageparameter enables the dashboard to fetch language-specific READMEs, working in tandem with the language change detection inupdated(). This ensures users see READMEs in their preferred language.src/data/repository.ts (3)
3-14: LGTM!The
getBaseLanguageCodefunction correctly extracts the base language code from BCP47 format (e.g., "de-DE" → "de") and handles edge cases appropriately. The implementation is simple, efficient, and well-documented.
16-36: LGTM!The backend language support caching mechanism is well-designed with promise-based synchronization to prevent race conditions. The tri-state cache (
null/true/false) appropriately tracks unknown, supported, and unsupported states. The reset function provides a useful testing hook.
87-123: LGTM!The function setup is well-structured with comprehensive documentation, backward-compatible signature, and proper language resolution logic. The decision to only send the language parameter for non-English languages is efficient and aligns with the feature requirements.
PULL_REQUEST.md (1)
1-229: LGTM!This comprehensive PR description provides excellent documentation of the multilingual README support feature. The inclusion of behavior descriptions, bug fix details, testing procedures, and implementation examples makes it easy for reviewers and future maintainers to understand the changes. The checklist confirms all critical aspects have been addressed.
- Remove all language processing logic from frontend - Frontend now only passes hass.language to backend - Remove getBaseLanguageCode() and backend support caching - Simplify fetchRepositoryInformation() to pass language directly
- Add getBaseLanguageCode() to extract base language from BCP47 format - Enhance fetchRepositoryInformation() to accept optional language parameter - Add language change detection in repository dashboard - Remove unnecessary comments and temporary debug files - Update PULL_REQUEST.md with proper checklist Related to backend PR #4965
Only document changes against main repository, not previous implementation errors
- Remove redundant Features, Behavior, Implementation Details sections - Remove Testing and Type of Change sections - Simplify File Naming Convention - Keep only essential information about changes
- Remove getBaseLanguageCode() function from frontend - Frontend now only passes hass.language directly to backend - All language processing (BCP47 extraction, fallback) handled by backend - Update PULL_REQUEST.md to reflect simplified implementation
- Remove unnecessary if condition in fetchRepositoryInformation - Always set language parameter (uses hass.language as fallback) - Remove obsolete .gitignore entries for deleted debug files
Co-authored-by: gewinkelt-alpha66 <[email protected]>
…() method - Remove accidentally committed PULL_REQUEST.md file - Add proper typing to updated() method with PropertyValues<this> - Remove dead code checking non-existent 'repositories' property
- Remove language parameter from getRepositories() function - Language support is now only for README files via repository/info
Add Multilingual README Support
Summary
This PR adds support for multilingual README files in HACS. The frontend passes the user's Home Assistant language setting (
hass.language) to the backend via thehacs/repository/infoWebSocket command. The backend handles all language processing, file selection, and fallback logic.Related Pull Requests
This frontend implementation requires the corresponding backend changes:
Changes
Repository Information Fetching (
src/data/repository.ts)languageparameter tofetchRepositoryInformation()functionlanguagefield in WebSocket message (useshass.languageas fallback)Repository Dashboard (
src/dashboards/hacs-repository-dashboard.ts)hass.languagewhen fetching repository informationupdated()lifecycle hook and automatically refetches repository dataDownload Dialog (
src/components/dialogs/hacs-download-dialog.ts)hass.languagewhen fetching repository informationChecklist
Notes
README.{language_code}.md(e.g.,README.de.md,README.fr.md). The defaultREADME.mdis always used as fallback.