Fall back to related languages for missing translations
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 42/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- sqlite, typescript
- Domain
- backend, internationalization
Research direction
Start with src/app/server_translations.ts, the main implementation file named in the issue. Trace how translations are read, saved, and revisioned, then identify the editor and migration entry points for the remaining requirements. Done means fallback follows LANGUAGES order, inherited values are handled correctly on save, revisions detect fallback edits, the editor identifies inherited text, and the one-time cleanup is complete.
Written by the indexing model from the issue text.
Description
Problem
Regional variants of a language (e.g. de-AT and de-DE) are translated independently. Every text has to be stored redundantly in each variant, and the variants can silently drift apart when only one is updated.
Proposal
When a text has no translation in the requested language, fall back to the other languages with the same base code before using the main language. The chain is derived automatically from the LANGUAGES order, so no configuration is needed:
de-AT→ otherde-*languages (inLANGUAGESorder) → main language- Example with
LANGUAGES="en,de-DE,de-AT":de-AT→de-DE→en
A variant then only stores what actually differs (e.g. "Jänner", "Servus" in de-AT); everything else is inherited from its siblings. Listing languages in the right order controls preference (e.g. put de-DE before de-AT if de-CH should prefer it).
Implementation notes
- Reading: overlay the fallback languages' translations first, then the requested language's own translations. Fallback works per text/media property, as translations already do, so a page may mix sources.
- Saving: compare edits against the inherited view, not the main language. Otherwise untouched inherited text gets copied into the variant on the first save. Text equal to the inherited value removes the variant's override (consistent with today's "equal to the original removes the translation").
- Versions: the translation revision must include the fallback languages' rows, so editing
de-DEmarks an opende-ATeditor as stale. - Editor: in translation mode, indicate which texts are inherited from a fallback language and which are overridden.
- Migration: one-time cleanup that removes variant values identical to their fallback.
Trade-offs
- A variant can no longer deliberately show the main-language text while a sibling has a translation (it would fall back to the sibling).
- Overrides don't follow later changes in the fallback language. That's usually intended, but could go stale unnoticed. A "fallback changed" indicator could be a follow-up.
Most of the change would live in src/app/server_translations.ts.
- Dominant language
- TypeScript
- Stars
- 1.8k
- Forks
- 148
- Avg merge
- 2h 47m
- Merged PRs (30d)
- 13
Getting set up
- Ships a Dockerfile or Docker Compose file
- No pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from michael/editable
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
michael/editable#181 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 38/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
Maintainers usually reply within 1 day
All issues in michael/editable
Similar issues
-
bug data-types
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
ClickHouse/clickhouse-js#1293 ·
Maintainers usually reply within 1 day
-
area: middleware enhancement good first issue
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
-
agent/quality testing
Difficulty 1/5 Under an hour Newbie friendliness 95/100
Maintainers usually reply within 1 day
-
GitHub registry install via `gh` credentials rewrites `\u0000`–`\u001f` escapes in source files to `^@`–`^_`Possibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 92/100
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
juspay/agent-distro#203 ·
Maintainers usually reply within 1 day