fix: gracefully handle missing translation files#364
Open
Conversation
Persist the `src/translations/` directory via `.gitkeep` so the Vite build does not fail when translation files have not been fetched. Also downgrade the translation load error from `error` to `warn` with a user-friendly message, since this is a recoverable situation that falls back to English. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What?
Ensure the editor does not fail to load when translation files are missing.
Why?
If the
src/translations/directory does not exist — for example, after setting up a new git worktree without runningmake prep-translations— the Vite dev server fails its dependency scan because the dynamic import inlocalization.jscannot resolve any translation files. This blocks the editor from loading entirely.How?
.gitkeeptosrc/translations/so the directory is always present in a fresh clone, giving Vite's dependency scanner something to resolve against..gitignoreto ignore translation file contents but preserve the.gitkeep.errortowarnwith a user-friendly message, since this is a recoverable situation that gracefully falls back to English.Testing Instructions
make dev-server-force(ensures Vite does not reuse caches).Previously observed error
Accessibility Testing Instructions
Not applicable — no UI changes.