forked from hacs/frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Add Multilingual README Support #1
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
Merged
Merged
Changes from 21 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
9338c5d
Add multilingual README support
bea0e52
Fix race condition and language change detection bugs
cfc2527
Update PR description with bug fixes documentation
5a3af08
Fix: Remove language parameter from message when backend doesn't supp…
ae029a7
docs: Add bug fix #3 to pull request description
3180c9d
docs: Update backend PR reference to #4965
557f8e3
chore: Add debug files to .gitignore
b5cb425
Fix: Handle null cache after concurrent backend support check
64c5660
docs: Update PR description with bug fix #4
d0b8454
Fix: Prevent duplicate requests after concurrent backend support check
109ab87
docs: Add bug fix #5 to PR description
32ba636
Refactor: Move multilingual README logic to backend
169f214
Add multilingual README support
4183752
Update PULL_REQUEST.md with testing requirements and type of change
934de21
Clean up PULL_REQUEST.md: remove redundant text and improve clarity
1f9bca1
Remove bug fixes section from PR description
4c1c890
Simplify PULL_REQUEST.md: remove redundant sections
6ec25ba
Refactor: Move language processing logic to backend
d66de08
Simplify language parameter handling and clean up .gitignore
a918ec5
Update PR description: simplify and clarify implementation details
c1c09fe
Update PR description: Add multilingual description support
fb9d1b9
Refactor: Add multilingual README and description support
cursoragent 05776dd
fix: Address review comments - remove PULL_REQUEST.md and fix updated…
93ffd45
refactor: Remove language parameter from getRepositories()
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -11,3 +11,4 @@ yarn-error.log | |
| .yarn/* | ||
| !.yarn/releases | ||
| !.yarn/releases/yarn-*.cjs | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| # Add Multilingual README and Description Support | ||
|
|
||
| ## Summary | ||
|
|
||
| This PR adds support for multilingual README files and repository descriptions in HACS. The frontend passes the user's Home Assistant language setting (`hass.language`) to the backend via the `hacs/repository/info` and `hacs/repositories/list` WebSocket commands. The backend handles all language processing, file selection, and fallback logic. | ||
|
|
||
| ## Related Backend PR | ||
|
|
||
| This frontend implementation requires the corresponding backend changes: | ||
| - **Backend PR:** https://github.com/hacs/integration/pull/4965 | ||
|
|
||
| ## Changes | ||
|
|
||
| 1. **Repository Information Fetching** (`src/data/repository.ts`) | ||
| - Added `language` parameter to `fetchRepositoryInformation()` function | ||
| - Always includes `language` field in WebSocket message (uses `hass.language` as fallback) | ||
|
|
||
| 2. **Repository List** (`src/data/websocket.ts`) | ||
| - Added `language` parameter to `getRepositories()` function | ||
| - Passes language to backend for multilingual description support | ||
|
|
||
| 3. **Repository Dashboard** (`src/dashboards/hacs-repository-dashboard.ts`) | ||
| - Passes `hass.language` when fetching repository information | ||
| - Detects language changes in `updated()` lifecycle hook and automatically refetches repository data | ||
|
|
||
| 4. **Download Dialog** (`src/components/dialogs/hacs-download-dialog.ts`) | ||
| - Passes `hass.language` when fetching repository information | ||
|
|
||
| ## Checklist | ||
|
|
||
| - [x] Code follows project style guidelines | ||
| - [x] Changes are backward compatible | ||
| - [x] Code tested locally | ||
| - [x] TypeScript types are correct | ||
| - [x] Works with backend PR #4965 | ||
|
|
||
| ## Notes | ||
|
|
||
| - This PR only implements the frontend changes. The backend must be updated separately (PR #4965). | ||
| - Repository maintainers can provide multilingual README files using the pattern `README.{language_code}.md` (e.g., `README.de.md`, `README.fr.md`). The default `README.md` is always used as fallback. | ||
| - Repository descriptions can also be multilingual using `DESCRIPTION.{language_code}.txt` files (e.g., `DESCRIPTION.de.txt`, `DESCRIPTION.fr.txt`). Falls back to GitHub repository description if not found. | ||
|
|
||
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.