1 # po2msg.sed - Convert Uniforum style .po file to X/Open style .msg file
2 # Copyright (C) 1995 Free Software Foundation, Inc.
3 # Ulrich Drepper <drepper@gnu.ai.mit.edu>, 1995.
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)
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 # The first directive in the .msg should be the definition of the
21 # message set number. We use always set number 1.
27 $ Automatically created by po2msg.sed
33 # We copy all comments into the .msg file. Perhaps they can help.
37 # We copy the original message as a comment into the .msg file.
43 # s/$/ ... (more lines following)"/
45 s/^msgid[ ]*"\(.*\)"$/$ Original Message: \1/
49 # The .msg file contains, other then the .po file, only the translations
50 # but each given a unique ID. Starting from 1 and incrementing by 1 for
51 # each message we assign them to the messages.
52 # It is important that the .po file used to generate the cat-id-tbl.c file
53 # (with po-to-tbl) is the same as the one used here. (At least the order
54 # of declarations must not be changed.)
57 s/msgstr[ ]*"\(.*\)"/\1/
59 # The following nice solution is by
60 # Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
62 # Increment a decimal number in pattern space.
63 # First hide trailing `9' digits.
67 # Assure at least one digit is available.
69 # Increment the last digit.
79 # Convert the hidden `9' digits to `0's.
82 # Bring the line in the format `<number> <message>'
85 s/\(.*\)\n\([0-9]*\)/\2 \1/
86 # Clear flag from last substitution.
88 # Append the next line.
91 # Look whether second part is a continuation line.
92 s/\(.*\n\)"\(.*\)"/\1\2/
97 # Note that `D' includes a jump to the start!!
98 # We found a continuation line. But before printing insert '\'.
100 s/\(.*\)\(\n.*\)/\1\\\2/
102 # We cannot use the sed command `D' here