Scripting tools to interact with Thea 2 The Shattering files in order to translate them easily.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

25 lines
635 B

  1. #!/bin/bash
  2. # to add document to zanata, extract .pot with:
  3. # grep Key DATABASE_UI_LOCALIZATION.xml | awk -F'"' '{print "#. "$2"\n" "msgid " "\""$4"\"" "\n" "msgstr " "\"\""}' > DATABASE_UI_LOCALIZATION.pot
  4. # then pass the .pot in poedit to merge duplication and add the Zanata header
  5. if [[ "$#" -ne 2 ]]; then
  6. echo "Please passe exactly 2 parameters: the .xml and the corresponding .po"
  7. exit 1
  8. fi
  9. LANGUAGE=${2}
  10. WORKDIR="/tmp/thea2/${LANGUAGE}"
  11. PO=${1}
  12. TXT="${PO%%.po}.txt"
  13. FINALDIR="$(pwd)/${LANGUAGE}"
  14. mkdir -p ${WORKDIR}
  15. mkdir -p ${FINALDIR}
  16. readarray -t file < ${PO}
  17. for line in "${file[@]}"; do
  18. echo $line
  19. done