s3-rpc_server: run minimal_includes.pl.
[samba.git] / source3 / intl / linux-msg.sed
1 # po2msg.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, see <http://www.gnu.org/licenses/>.
17 #
18 #
19 # The first directive in the .msg should be the definition of the
20 # message set number.  We use always set number 1.
21 #
22 1 {
23   i\
24 $set 1 # Automatically created by po2msg.sed
25   h
26   s/.*/0/
27   x
28 }
29 #
30 # Mitch's old catalog format does not allow comments.
31 #
32 # We copy the original message as a comment into the .msg file.
33 #
34 /^msgid/ {
35   s/msgid[      ]*"//
36 #
37 # This does not work now with the new format.
38 # /"$/! {
39 #   s/\\$//
40 #   s/$/ ... (more lines following)"/
41 # }
42   x
43 # The following nice solution is by
44 # Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
45   td
46 # Increment a decimal number in pattern space.
47 # First hide trailing `9' digits.
48   :d
49   s/9\(_*\)$/_\1/
50   td
51 # Assure at least one digit is available.
52   s/^\(_*\)$/0\1/
53 # Increment the last digit.
54   s/8\(_*\)$/9\1/
55   s/7\(_*\)$/8\1/
56   s/6\(_*\)$/7\1/
57   s/5\(_*\)$/6\1/
58   s/4\(_*\)$/5\1/
59   s/3\(_*\)$/4\1/
60   s/2\(_*\)$/3\1/
61   s/1\(_*\)$/2\1/
62   s/0\(_*\)$/1\1/
63 # Convert the hidden `9' digits to `0's.
64   s/_/0/g
65   x
66   G
67   s/\(.*\)"\n\([0-9]*\)/$ #\2 Original Message:(\1)/p
68 }
69 #
70 # The .msg file contains, other then the .po file, only the translations
71 # but each given a unique ID.  Starting from 1 and incrementing by 1 for
72 # each message we assign them to the messages.
73 # It is important that the .po file used to generate the cat-id-tbl.c file
74 # (with po-to-tbl) is the same as the one used here.  (At least the order
75 # of declarations must not be changed.)
76 #
77 /^msgstr/ {
78   s/msgstr[     ]*"\(.*\)"/# \1/
79 # Clear substitution flag.
80   tb
81 # Append the next line.
82   :b
83   N
84 # Look whether second part is continuation line.
85   s/\(.*\n\)"\(.*\)"/\1\2/
86 # Yes, then branch.
87   ta
88   P
89   D
90 # Note that D includes a jump to the start!!
91 # We found a continuation line.  But before printing insert '\'.
92   :a
93   s/\(.*\)\(\n.*\)/\1\\\2/
94   P
95 # We cannot use D here.
96   s/.*\n\(.*\)/\1/
97   tb
98 }
99 d