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.

47 lines
1.6 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. dos2unix /tmp/DATABASE_UI_LOCALIZATION.pot.tmp
  8. sed -i 's/\\E/\\\\E/' /tmp/DATABASE_UI_LOCALIZATION.pot.tmp
  9. # Insert header
  10. msgid ""
  11. msgstr ""
  12. "MIME-Version: 1.0\n"
  13. "Content-Transfer-Encoding: 8bit\n"
  14. "Content-Type: text/plain; charset=UTF-8\n"
  15. "Project-Id-Version: \n"
  16. "POT-Creation-Date: \n"
  17. "PO-Revision-Date: \n"
  18. "Last-Translator: \n"
  19. "Language-Team: \n"
  20. msguniq --no-wrap /tmp/DATABASE_UI_LOCALIZATION.pot.tmp > Database/pot/DATABASE_UI_LOCALIZATION.pot
  21. ```
  22. To rollback from po:
  23. ```bash
  24. ./rollback_database.sh Database/game_files/DATABASE_UI_LOCALIZATION.xml Translation/fr/po/Database/DATABASE_UI_LOCALIZATION.po fr
  25. ./rollback_database.sh Database/game_files/DATABASE_QUEST_LOCALIZATION.xml Translation/fr/po/Database/DATABASE_QUEST_LOCALIZATION.po fr
  26. ./rollback_database.sh Database/game_files/DATABASE_DES_LOCALIZATION.xml Translation/fr/po/Database/DATABASE_DES_LOCALIZATION.po fr
  27. ```
  28. ## Modules
  29. To convert from txt:
  30. ```bash
  31. for text in Modules/game_files/*; do ./extract_module.sh "${text}"; done
  32. ```
  33. To convert back from po:
  34. ```bash
  35. 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)";
  36. ```