i18n-merge.tcl 991 B

12345678910111213141516171819202122232425262728293031
  1. #!/usr/bin/env tclsh
  2. #
  3. # Merge translation template (pot file) into translation files (po files).
  4. #
  5. # Copyright 2015-2017 OpenIndex.de.
  6. # Distributed under the MIT License.
  7. # See accompanying LICENSE.txt file or at http://opensource.org/licenses/MIT
  8. #
  9. # initialization
  10. source [file join [file normalize [file dirname $argv0]] init.tcl]
  11. puts ""
  12. puts "========================================================================="
  13. puts " $PROJECT $VERSION: merge translations"
  14. puts "========================================================================="
  15. puts ""
  16. if {$MSGMERGE == "" || ![file isfile $MSGMERGE] || ![file executable $MSGMERGE]} {
  17. puts "ERROR: Can't find the msgmerge application!"
  18. exit 1
  19. }
  20. foreach po [glob -nocomplain -directory $I18N_PO_DIR -type f "*.po"] {
  21. puts "merge $po"
  22. if { [catch {exec $MSGMERGE -q -U [file nativename $po] [file nativename $I18N_POT]} result] } {
  23. puts "ERROR: Can't merge translation!"
  24. puts "at: $po"
  25. puts $::errorInfo
  26. }
  27. }