anastasis

Credential backup and recovery protocol and service
Log | Files | Refs | Submodules | README | LICENSE

extract.sh (715B)


      1 #!/bin/sh
      2 # This file is in the public domain.
      3 # It extracts translateable strings from the JSON file(s).
      4 #
      5 # The resulting 'extracted.h' file is only used by
      6 # gettext, and not in the actual code. We still make
      7 # sure it is legal C code.
      8 
      9 for n in redux.??.json
     10 do
     11     jq '.required_attributes[].label' < $n | awk '{print "_(" $0 "),"}' >> prep.h
     12 done
     13 
     14 jq '.countries[].continent' < redux.countries.json | awk '{print "_(" $0 "),"}' >> prep.h
     15 
     16 jq '.countries[].name' < redux.countries.json | awk '{print "_(" $0 "),"}' >> prep.h
     17 
     18 echo "// This is a generated file, see extract.sh" > extracted.h
     19 echo "const char * i18n[] = {" >> extracted.h
     20 sort prep.h | uniq >> extracted.h
     21 echo "};" >> extracted.h
     22 
     23 rm -f prep.h