home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / tar-1.11.8-src.tgz / tar.out / fsf / tar / intl / linux-msg.sed < prev    next >
Text File  |  1996-09-28  |  2KB  |  90 lines

  1. # po-to-msg.sed - Convert Uniforum style .po file to Linux style .msg file
  2. # Copyright (C) 1995 Free Software Foundation, Inc.
  3. # Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
  4. #
  5. # This program is free software; you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation; either version 2, or (at your option)
  8. # any later version.
  9. #
  10. # This program is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with this program; if not, write to the Free Software
  17. # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  18. #
  19. #
  20. # The first directive in the .msg should be the definition of the
  21. # message set number.  We use always set number 1.
  22. #
  23. 1 {
  24.   i\
  25. $set 1 # Automatically created by po-to-msg
  26.   h
  27.   s/.*/0/
  28.   x
  29. }
  30. #
  31. # Mitch's old catalog format does not allow comments.
  32. # We copy the original message as a comment into the .msg file.
  33. #
  34. /^msgid/ {
  35.   s/msgid[     ]*"//
  36.   /"$/!s/$/ ... (more lines following)"/
  37.   x
  38. # The following nice solution is by
  39. # Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
  40.   td
  41. # Increment a decimal number in pattern space.
  42. # First hide trailing `9' digits.
  43.   :d
  44.   s/9\(_*\)$/_\1/
  45.   td
  46. # Assure at least one digit is available.
  47.   s/^\(_*\)$/0\1/
  48. # Increment the last digit.
  49.   s/8\(_*\)$/9\1/
  50.   s/7\(_*\)$/8\1/
  51.   s/6\(_*\)$/7\1/
  52.   s/5\(_*\)$/6\1/
  53.   s/4\(_*\)$/5\1/
  54.   s/3\(_*\)$/4\1/
  55.   s/2\(_*\)$/3\1/
  56.   s/1\(_*\)$/2\1/
  57.   s/0\(_*\)$/1\1/
  58. # Convert the hidden `9' digits to `0's.
  59.   s/_/0/g
  60.   x
  61.   G
  62.   s/\(.*\)"\n0*\(.*\)/$ #\2 Original Message:(\1)/p
  63. }
  64. #
  65. # The .msg file contains, other then the .po file, only the translations
  66. # but each given a unique ID.  Starting from 1 and incrementing by 1 for
  67. # each message we assign them to the messages.
  68. # It is important that the .po file used to generate the cat-id-tbl.c file
  69. # (with po-to-tbl) is the same as the one used here.  (At least the order
  70. # of declarations must not be changed.)
  71. #
  72. /^msgstr/ {
  73.   s/msgstr[     ]*"/# /
  74. # Yes, this jump IS necessary :)
  75.   ta
  76.   :a
  77.   s/\\$/\\/
  78.   tc
  79.   bb
  80.   :c
  81.   n
  82.   s/\\$/\\/
  83.   tc
  84.   :b
  85.   s/\(.*\)"$/\1/
  86.   p
  87. }
  88. d
  89.