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.

45 lines
1.4 KiB

5 years ago
  1. # thea2Shattering_i18n_tools
  2. Scripting tools to interact with Thea 2 The Shattering's files in order to translate them easily.
  3. ## Databases
  4. To convert from XML
  5. ```bash
  6. grep Key Database/game_files/DATABASE_UI_LOCALIZATION.xml | grep -v "UI_EMPTY" | grep -v '<!--<Entry' | awk -F'"' '{print "#. "$2"\n" "msgid " "\""$4"\"" "\n" "msgstr " "\"\""}' > /tmp/DATABASE_UI_LOCALIZATION.pot.tmp
  7. sed -i 's/\\E/\\\\E/' /tmp/DATABASE_UI_LOCALIZATION.pot.tmp
  8. # Insert header
  9. msgid ""
  10. msgstr ""
  11. "MIME-Version: 1.0\n"
  12. "Content-Transfer-Encoding: 8bit\n"
  13. "Content-Type: text/plain; charset=UTF-8\n"
  14. "Project-Id-Version: \n"
  15. "POT-Creation-Date: \n"
  16. "PO-Revision-Date: \n"
  17. "Last-Translator: \n"
  18. "Language-Team: \n"
  19. msguniq --no-wrap /tmp/DATABASE_UI_LOCALIZATION.pot.tmp > Database/pot/DATABASE_UI_LOCALIZATION.pot
  20. ```
  21. To rollback from po:
  22. ```bash
  23. ./rollback_database.sh Database/game_files/DATABASE_UI_LOCALIZATION.xml Translation/fr/po/Database/DATABASE_UI_LOCALIZATION.po fr
  24. ./rollback_database.sh Database/game_files/DATABASE_DES_LOCALIZATION.xml Translation/fr/po/Database/DATABASE_DES_LOCALIZATION.po fr
  25. ```
  26. ## Modules
  27. To convert from txt:
  28. ```bash
  29. for text in Modules/game_files/*; do ./extract_module.sh "${text}"; done
  30. ```
  31. To convert back from po:
  32. ```bash
  33. echo "start at $(date)"; time for i in Translation/fr/po/Modules/*; do echo "rollback ${i}..."; time ./rollback_module.sh "${i}" fr; echo "done"; done; echo "end at $(date)";
  34. ```