Fall back to source language instead of showing undefined #1918
Replies: 7 comments 4 replies
-
We can't fallback to the source language. Once per language splitting is implemented, falling back to the source language is not possible (client-side). We strongly recommend setting up CI/CD that lints missing translations via the inlang CLI and use the machine translate command of the CLI to avoid missing translations altogether. Returning undefined is a bit annoying though. We should (and had at one point) return the message id instead to enable CMD + F searches for the message id |
Beta Was this translation helpful? Give feedback.
-
message id's sound good, but i think there should be atleast file/route level fallbacks - if a page with 10 routes only has 9 of them translated, is it still worth not allowing that translation to be used? this can especially happen with community translations, when people translate only as much as they currently have time for |
Beta Was this translation helpful? Give feedback.
-
Maybe in the future if more users ask for it. In the meantime, integrate |
Beta Was this translation helpful? Give feedback.
-
Machine translation is unsuitable for translating software because of the missing context. And for a lot of applications, most users prefer English instead of bad machine translations. Abozt the code splitting issue: loading 2 translations instead of 1 should not add a significant amount of code to the bundle. I agree that this should not be the default option but you should be able to configure a fallback language if necessary. |
Beta Was this translation helpful? Give feedback.
-
Reopening in response to https://discord.com/channels/897438559458430986/1083724234142011392/1186525642540453928 @samuelstroschein For Example if This may cause some confusion as to if messages are present, so I would also suggest somehow warning when this happens. |
Beta Was this translation helpful? Give feedback.
-
@LorisSigrist let's move this to a feature request in the discussions |
Beta Was this translation helpful? Give feedback.
-
It's useful to know when a translation is undefined. One situation could be:
// fallback if necessary
greetingNew() ?? greeting() What I'm seeing right now is something like export { greetingNew } from "./en-US.js" Which makes it impossible to know if it's translated or not. Comparing to an the english string explicitly isn't suitable either because it could be that the translation overlaps between english and another language. There's probably other situations where it's valuable to know if the translation at source exists or not. |
Beta Was this translation helpful? Give feedback.
-
Problem
when a key is not defined, there should be an option in
project.inlang.json
that makes it so that instead of showing undefined, all keys would fallback to source language. if a source language doesen't have a key, but other languages do, then it's okay to show undefined, since that's a big mistake.Expected behavior
optionally, translations should fallback back to source language
Reproduction
make a new key
only include source language
switch to other language
see that it renders 'undefined'
Other information
Vivaldi latest stable
Windows 10
inlang ext 1.20.0
Beta Was this translation helpful? Give feedback.
All reactions