fix(editor): a missing translation must not become a document error - #194
Merged
Conversation
Reported in Korean: opening a blank document showed the vendor's modal
"An error occurred while working with the document. Use the 'Download
as' option to save a backup copy" -- before typing anything. Reproduced
in a production build; only ko, and every time.
The cause is a translation gap. `DE.Views.Statusbar.tipMultiplePages` is
in en.json and not in ko.json, and unlike most strings it has no default
in the component's own source, so the property is `undefined`. The status
bar passes it to a tooltip setter that does not check:
updateHint: function (t) { ... "string" == typeof t ? t : t[0] ... }
`undefined[0]` throws inside the view layer, the app catches it as a
document error, and the user gets a modal telling them to save a backup
of a document they have not written yet.
This is not one bad file: all 44 non-English locales are short against
en.json, from 1 key to 3167. Korean simply lost the lottery of which gap
reaches a tooltip setter. So there are two defences:
1. bin/locale-fill.mjs backfills, from en.json, every key missing in the
locales this site is translated into -- 17 files, ~113 KB, keeping the
vendor's minified formatting so the tree does not grow by 25 KB a file.
bin/build.sh runs it before the vendor tree is hashed into
VENDOR_VERSION, and test/unit/vendor-locale.test.ts fails when it has
not been run (which is what a vendor upgrade will do).
2. Guard 11 (guards/hint-fallback.ts) makes `updateHint(undefined)` a
no-op. That covers the other 38 locales, which `?locale=` can still
select, and whatever the next upgrade breaks.
An English tooltip is a blemish. A modal error on an empty document is
someone deciding this editor cannot be trusted with their file.
test/e2e/editor-locales.spec.ts opens a blank document in each of the six
non-English site languages and fails on a vendor dialog -- nothing in the
suite covered this, because everything else opens the editor in English.
Reverse-checked both defences: with the key removed and the guard
disabled the ko case fails with the reported dialog; with the key removed
and the guard in place it passes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
chaxus
enabled auto-merge (rebase)
August 23, 2026 03:32
Deploying document with
|
| Latest commit: |
4ae7204
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://33f6ac5b.document-7hm.pages.dev |
| Branch Preview URL: | https://fix-locale-hint-crash.document-7hm.pages.dev |
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.
Reported in Korean: opening a blank document showed the vendor's modal "An error occurred while working with the document. Use the 'Download as' option to save a backup copy" — before typing anything. Reproduced in a production build; only
ko, and every time.Cause
DE.Views.Statusbar.tipMultiplePagesis inen.jsonand not inko.json, and unlike most strings it has no default in the component's own source — so the property isundefined. The status bar hands it to a tooltip setter that does not check:undefined[0]throws inside the view layer, the app catches it as a document error, and the user is told to save a backup of a document they have not written yet.This is not one bad file: all 44 non-English locales are short against en.json, from 1 key to 3167. Korean simply lost the lottery of which gap reaches a tooltip setter.
Two defences
bin/locale-fill.mjsbackfills, fromen.json, every key missing in the locales this site is translated into — 17 files, ~113 KB, keeping the vendor's minified formatting (pretty-printing would have added ~25 KB per file to a 600 MB tree).bin/build.shruns it before the vendor tree is hashed intoVENDOR_VERSION, andtest/unit/vendor-locale.test.tsfails when it has not been run — which is exactly what the next vendor upgrade will do.guards/hint-fallback.ts) makesupdateHint(undefined)a no-op. That covers the other 38 locales, which?locale=can still select, and whatever the next upgrade breaks.An English tooltip is a blemish. A modal error on an empty document is someone deciding this editor cannot be trusted with their file.
Test
test/e2e/editor-locales.spec.tsopens a blank document in each of the six non-English site languages and fails on a vendor dialog. Nothing in the suite covered this, because everything else opens the editor in English.Reverse-checked both defences separately:
kocase fails with the reported dialog🤖 Generated with Claude Code