switched over to a new method of handling uppercase/lowercase mappings
[samba.git] / source3 / intl / xopen-msg.sed
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.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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
26   i\
27 $ Automatically created by po2msg.sed
28   h
29   s/.*/0/
30   x
31 }
32 #
33 # We copy all comments into the .msg file.  Perhaps they can help.
34 #
35 /^#/ s/^#[      ]*/$ /p
36 #
37 # We copy the original message as a comment into the .msg file.
38 #
39 /^msgid/ {
40 # Does not work now
41 #  /"$/! {
42 #    s/\\$//
43 #    s/$/ ... (more lines following)"/
44 #  }
45   s/^msgid[     ]*"\(.*\)"$/$ Original Message: \1/
46   p
47 }
48 #
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.)
55 #
56 /^msgstr/ {
57   s/msgstr[     ]*"\(.*\)"/\1/
58   x
59 # The following nice solution is by
60 # Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
61   td
62 # Increment a decimal number in pattern space.
63 # First hide trailing `9' digits.
64   :d
65   s/9\(_*\)$/_\1/
66   td
67 # Assure at least one digit is available.
68   s/^\(_*\)$/0\1/
69 # Increment the last digit.
70   s/8\(_*\)$/9\1/
71   s/7\(_*\)$/8\1/
72   s/6\(_*\)$/7\1/
73   s/5\(_*\)$/6\1/
74   s/4\(_*\)$/5\1/
75   s/3\(_*\)$/4\1/
76   s/2\(_*\)$/3\1/
77   s/1\(_*\)$/2\1/
78   s/0\(_*\)$/1\1/
79 # Convert the hidden `9' digits to `0's.
80   s/_/0/g
81   x
82 # Bring the line in the format `<number> <message>'
83   G
84   s/^[^\n]*$/& /
85   s/\(.*\)\n\([0-9]*\)/\2 \1/
86 # Clear flag from last substitution.
87   tb
88 # Append the next line.
89   :b
90   N
91 # Look whether second part is a continuation line.
92   s/\(.*\n\)"\(.*\)"/\1\2/
93 # Yes, then branch.
94   ta
95   P
96   D
97 # Note that `D' includes a jump to the start!!
98 # We found a continuation line.  But before printing insert '\'.
99   :a
100   s/\(.*\)\(\n.*\)/\1\\\2/
101   P
102 # We cannot use the sed command `D' here
103   s/.*\n\(.*\)/\1/
104   tb
105 }
106 d