Difference between revisions of "Translating JSON"
Jump to navigation
Jump to search
Line 5: | Line 5: | ||
<infile.json jq 'to_entries|.[]|{ (.key):("</apertium-notrans>\(.value)<apertium-notrans>") }' <nn/translation.json | |
<infile.json jq 'to_entries|.[]|{ (.key):("</apertium-notrans>\(.value)<apertium-notrans>") }' <nn/translation.json | |
||
grep -v '[{}]' | |
grep -v '^[{}]$' | |
||
sed -e 's/$/,/' -e '$a }</apertium-notrans>' -e '1i <apertium-notrans>{' | |
sed -e 's/$/,/' -e '$a }</apertium-notrans>' -e '1i <apertium-notrans>{' | |
||
apertium -u nob-nno -f html-noent >outfile.json |
apertium -u nob-nno -f html-noent >outfile.json |
Revision as of 09:11, 30 May 2014
TODO: simple method to translate json files (like the ones in apertium-html-tools)
this halfway works:
<infile.json jq 'to_entries|.[]|{ (.key):("</apertium-notrans>\(.value)<apertium-notrans>") }' <nn/translation.json | grep -v '^[{}]$' | sed -e 's/$/,/' -e '$a }</apertium-notrans>' -e '1i <apertium-notrans>{' | apertium -u nob-nno -f html-noent >outfile.json