update-po 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/sh
  2. # * Copyright © 2002 Wilbert Berendsen <wilbert@oswf.org>
  3. # *
  4. # * This file is free software; you can redistribute it and/or modify it
  5. # * under the terms of the GNU General Public License as published by
  6. # * the Free Software Foundation; either version 2 of the License, or
  7. # * (at your option) any later version.
  8. # *
  9. # * This program is distributed in the hope that it will be useful, but
  10. # * WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  12. # * General Public License for more details.
  13. # *
  14. # * You should have received a copy of the GNU General Public License
  15. # * along with this program; if not, write to the Free Software
  16. # * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  17. # *
  18. # update-po -- for Sylpheed
  19. # by Wilbert Berendsen
  20. # This script updates the .po files named on the command line.
  21. # Run this script from within the po/ directory!
  22. if [ "$1" -a -f "$1" ] ; then
  23. #
  24. # Make a messages.pot file containing all the msgid's from
  25. # the source
  26. make -C .. -f - <<EOF
  27. sources = \$(shell cat po/POTFILES.in)
  28. po/messages.pot: \$(sources) po/POTFILES.in
  29. xgettext --keyword=N_ --keyword=_ --file=po/POTFILES.in \
  30. --output=po/messages.pot
  31. EOF
  32. #
  33. # Update all the xx.po files named on the commandline.
  34. for po in $@ ; do
  35. # Save xx.po in xx.po.old
  36. cp $po $po.old
  37. echo "Updating $po..."
  38. msgmerge $po.old messages.pot > $po
  39. done
  40. else
  41. echo
  42. echo "Usage:"
  43. echo
  44. echo " ./`basename $0` lang.po lang2.po ..."
  45. echo
  46. echo "to update one or more <yourlang>.po files from the sourcecode files"
  47. echo "named in POTFILES.in. The old .po file is save in a .po.old file."
  48. echo
  49. echo "When you e.g. want to update fr.po, run ./`basename $0` fr.po, then"
  50. echo "edit fr.po to update your translation."
  51. echo
  52. fi