github.com/dcarley/cf-cli@v6.24.1-0.20170220111324-4225ff346898+incompatible/bin/i18n-checkup (about) 1 #!/usr/bin/env bash 2 3 set -e 4 5 if [[ "$OSTYPE" == "darwin14" ]]; then 6 tmpdir=/tmp/i18n-checkup-$(uuidgen) 7 mkdir -p ${tmpdir} 8 else 9 tmpdir=$(mktemp -d) 10 fi 11 12 function cleanup { 13 rm -rf ${tmpdir} 14 } 15 trap cleanup EXIT 16 17 if [ ! $(which goi18n) ];then 18 echo -e "\n Installing go-i18n..." 19 go get github.com/nicksnyder/go-i18n/goi18n 20 fi 21 22 echo -e "\n Updating i18n4go..." 23 go get -u github.com/XenoPhex/i18n4go/i18n4go 24 if [ $? -ne 0 ]; then 25 printf "Failed to run `go get -u github.com/XenoPhex/i18n4go/i18n4go`" 26 exit 1 27 fi 28 29 30 IGNORE_FILES_REGEX=".*test.go|.*resources.go|fake.*\.go|template.go" 31 32 i18n4go -c extract-strings -e strings/excluded.json -s strings/specialStrings.json -o ${tmpdir} -d command -r --ignore-regexp $IGNORE_FILES_REGEX 33 i18n4go -c extract-strings -e strings/excluded.json -s strings/specialStrings.json -o ${tmpdir} -d cf -r --ignore-regexp $IGNORE_FILES_REGEX 34 i18n4go -c merge-strings -d ${tmpdir} 35 36 i18n4go -c fixup --source-language-file ${tmpdir}/en.all.json 37 38 set +e 39 40 goi18n -outdir cf/i18n/resources cf/i18n/resources/*.all.json 41 if [ $? -ne 0 ]; then 42 printf "Failed to run `goi18n -outdir cf/i18n/resources cf/i18n/resources/*.all.json`" 43 exit 1 44 fi 45 46 if [[ $(git status --porcelain cf/i18n/resources) ]]; then 47 bin/generate-language-resources 48 if [ $? -ne 0 ]; then 49 printf "Failed to run `bin/generate-language-resources`" 50 exit 1 51 fi 52 fi 53 54 git checkout cf/i18n/resources/en-us.untranslated.json 55