ever-traduora
ever-traduora copied to clipboard
Support importing null values
Is your feature request related to a problem? Please describe. I'm currently unable to import JSON translation files that contain null values:
The file that you are trying to import is either malformed or not the right format, please check that it is valid before trying again.
Context:
I use ngx-translate
to handle localization in Angular apps. When the value is null
for some key, the default language is used. Example:
en.json
{
"key1": "value"
}
es.json
{
"key1": null
}
Trying to translate {{ "key1" | translate }}
would display value
if the en
locale is used as default and the es
translation is missing. However, if the value is an empty string, it won't be displayed.
Describe the solution you'd like
Allow importing JSON files with null
values, treating them as missing translations.
Describe alternatives you've considered
Filtering out key-value pairs that have null
values during import (instead of throwing an error) would also be an option, as the terms would still be picked from the reference locale.
import from JSON file as a dict and run a null check to ignore them