Allow strings in JSON format to use one JSON key as the ID and another as the translation #8576
Labels
enhancement
Adding or requesting a new feature.
translate-toolkit
Issues which need to be fixed in the translate-toolkit
Projects
Milestone
Describe the problem
The JSON formats currently supported by weblate all assume that the JSON looks something like this:
However, my JSON looks something like this:
I can mark the
"lang"
key as read only, so there's no trouble there, but each field in messages shows up as a translatable string, ie.messages[0].id
andmessages[0].translation
. This isn't the end of the world, except that to a non-technical translator it looks as if they should translate "id". If I mark the ID field as read-only it does not get copied into the JSON from the source strings file, so we end up with a broken entry that contains the translation but no ID.Describe the solution you'd like
It would be nice if you could specify a field where its value would act as the ID instead of assuming the field name is the ID. Alternatively, Go's
gotext
format from https://pkg.go.dev/golang.org/x/text/cmd/gotext could be supported directly (though it's not widely used and not very well documented, so it may not be ready for native support yet and this could probably be implemented in a generic way anyways).Describe alternatives you've considered
Right now I'm just allowing the
id
keys to be translated and requiring review for all translations so that I can tell people not to translate that key.Screenshots
Additional context
No response
The text was updated successfully, but these errors were encountered: