source: trunk/third/gnome-core/intl/xopen-msg.sed @ 15328

Revision 15328, 2.7 KB checked in by ghudson, 24 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r15327, which included commits to RCS files with non-trunk default branches.
Line 
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#
231 {
24  i\
25$set 1 # Automatically created by po2msg.sed
26  h
27  s/.*/0/
28  x
29}
30#
31# We copy all comments into the .msg file.  Perhaps they can help.
32#
33/^#/ s/^#[      ]*/$ /p
34#
35# We copy the original message as a comment into the .msg file.
36#
37/^msgid/ {
38# Does not work now
39#  /"$/! {
40#    s/\\$//
41#    s/$/ ... (more lines following)"/
42#  }
43  s/^msgid[     ]*"\(.*\)"$/$ Original Message: \1/
44  p
45}
46#
47# The .msg file contains, other then the .po file, only the translations
48# but each given a unique ID.  Starting from 1 and incrementing by 1 for
49# each message we assign them to the messages.
50# It is important that the .po file used to generate the cat-id-tbl.c file
51# (with po-to-tbl) is the same as the one used here.  (At least the order
52# of declarations must not be changed.)
53#
54/^msgstr/ {
55  s/msgstr[     ]*"\(.*\)"/\1/
56  x
57# The following nice solution is by
58# Bruno <Haible@ma2s2.mathematik.uni-karlsruhe.de>
59  td
60# Increment a decimal number in pattern space.
61# First hide trailing `9' digits.
62  :d
63  s/9\(_*\)$/_\1/
64  td
65# Assure at least one digit is available.
66  s/^\(_*\)$/0\1/
67# Increment the last digit.
68  s/8\(_*\)$/9\1/
69  s/7\(_*\)$/8\1/
70  s/6\(_*\)$/7\1/
71  s/5\(_*\)$/6\1/
72  s/4\(_*\)$/5\1/
73  s/3\(_*\)$/4\1/
74  s/2\(_*\)$/3\1/
75  s/1\(_*\)$/2\1/
76  s/0\(_*\)$/1\1/
77# Convert the hidden `9' digits to `0's.
78  s/_/0/g
79  x
80# Bring the line in the format `<number> <message>'
81  G
82  s/^[^\n]*$/& /
83  s/\(.*\)\n\([0-9]*\)/\2 \1/
84# Clear flag from last substitution.
85  tb
86# Append the next line.
87  :b
88  N
89# Look whether second part is a continuation line.
90  s/\(.*\n\)"\(.*\)"/\1\2/
91# Yes, then branch.
92  ta
93  P
94  D
95# Note that `D' includes a jump to the start!!
96# We found a continuation line.  But before printing insert '\'.
97  :a
98  s/\(.*\)\(\n.*\)/\1\\\2/
99  P
100# We cannot use the sed command `D' here
101  s/.*\n\(.*\)/\1/
102  tb
103}
104d
Note: See TracBrowser for help on using the repository browser.