mk_translation.bat 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. @echo off
  2. rem compile translation files (*.po --> sylpheed-claws.mo)
  3. rem assumes msgfmt and utf8conv in apps subdir
  4. if not %1x==x%1 goto process
  5. echo Creating translations:
  6. if not exist locale mkdir locale
  7. for %%i in ( bg cs de el en_GB es fr hr hu it ja ko nl pl pt_BR ru sk sr sv zh_CN zh_TW.Big5 ) do call %0 %%i
  8. echo Done. Copy "locale" folder to your sylpheed directory.
  9. goto end
  10. :process
  11. echo Processing %1 ...
  12. if not exist locale\%1 mkdir locale\%1
  13. if not exist locale\%1\LC_MESSAGES mkdir locale\%1\LC_MESSAGES
  14. rem *** utf8 translation ***
  15. SET CONTENTTYPE=^.Content-Type: text\/plain; charset=
  16. copy ..\..\po\%1.po > NUL
  17. echo @echo off > mk_%1.bat
  18. echo set PATH=apps;%%PATH%% >> mk_%1.bat
  19. rem *** extract orig. encoding ***
  20. sed -n -e "/%CONTENTTYPE%/ {s/.*=/iconv -f /;s/\\\\.*/ -t utf-8 %1.po/;p;} " %1.po >> mk_%1.bat
  21. rem new gettext weirdness: bg el ja ko zh* need (correct) "charset=utf-8"
  22. rem while others need local charset declared (though file is utf-8 as well)
  23. rem let's hope for better times...
  24. call mk_%1.bat > %1-utf8.po
  25. rem *** make .mo ***
  26. apps\msgfmt -o locale\%1\LC_MESSAGES\sylpheed-claws.mo %1-utf8.po 2>NUL
  27. if not ERRORLEVEL 1 goto CLEANUP
  28. echo gettext workaround required...
  29. call mk_%1.bat > %1-utf8.po.in
  30. rem *** modifiy "charset=XXX" line in *.po ***
  31. sed -e "/%CONTENTTYPE%/ { s#=.*#=utf-8\\\\n""#; }" %1-utf8.po.in > %1-utf8.po
  32. rem *** make .mo ***
  33. apps\msgfmt -o locale\%1\LC_MESSAGES\sylpheed-claws.mo %1-utf8.po
  34. del %1-utf8.po.in
  35. :CLEANUP
  36. del %1.po %1-utf8.po mk_%1.bat
  37. :end