svelte-i18n
svelte-i18n copied to clipboard
Allow return of empty translations
Hello, is it possible to allow empty translations? By a quick look I think this is the relevant code: https://github.com/kaisermann/svelte-i18n/blob/0516bb417c4d510e5cd5d225b60cb6ad469118a5/src/runtime/includes/lookup.ts#L31
In my case, it currently works like this: With translations:
{
"translations": {
"translation": ""
}
}
the result of $_("translations.translation") is translations.translation
Thanks
We would also appreciate this, tbh. There’s a couple of possible fixes for it:
if (message != null) {
// …
}
Better, I think, would be checking for a string value (because $_("translations") shouldn’t really be rendered, should it?):
if (typeof message === 'string') {
// …
}
+1
It is however a breaking change, as my doesTranslationExist function checks if t(key) !== key, which hopefully won't be the case anymore if this is fixed.