From ad84beae9be06107ddd20c763ea9fff9709ec365 Mon Sep 17 00:00:00 2001 From: Gonzalo Paniagua Javier Date: Tue, 16 Dec 2003 15:04:26 +0000 Subject: [PATCH] 2003-12-16 Gonzalo Paniagua Javier * monoresgen.cs: ignore entries marked as 'fuzzy' in .po files. svn path=/trunk/mcs/; revision=21237 --- mcs/monoresgen/ChangeLog | 4 ++++ mcs/monoresgen/monoresgen.cs | 32 +++++++++++++++++++++++++++----- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/mcs/monoresgen/ChangeLog b/mcs/monoresgen/ChangeLog index 4e99641d597..bd0c5bfc3e0 100755 --- a/mcs/monoresgen/ChangeLog +++ b/mcs/monoresgen/ChangeLog @@ -1,3 +1,7 @@ +2003-12-16 Gonzalo Paniagua Javier + + * monoresgen.cs: ignore entries marked as 'fuzzy' in .po files. + 2003-12-12 Gonzalo Paniagua Javier * monoresgen.cs: generate valid .po files. Fixes bug #52106. diff --git a/mcs/monoresgen/monoresgen.cs b/mcs/monoresgen/monoresgen.cs index 7c373379faf..6f126392f30 100755 --- a/mcs/monoresgen/monoresgen.cs +++ b/mcs/monoresgen/monoresgen.cs @@ -295,20 +295,41 @@ class PoResourceReader : IResourceReader { string line; string msgid = null; string msgstr = null; + bool ignoreNext = false; while ((line = reader.ReadLine ()) != null) { line_num++; line = line.Trim (); - if (line.Length == 0 || line [0] == '#' || - line [0] == ';') + if (line.Length == 0) continue; - + + if (line [0] == '#') { + if (line.Length == 1 || line [1] != ',') + continue; + + if (line.IndexOf ("fuzzy") != -1) { + ignoreNext = true; + if (msgid != null) { + if (msgstr == null) + throw new FormatException ("Error. Line: " + line_num); + data.Add (msgid, msgstr); + msgid = null; + msgstr = null; + } + + continue; + } + } + if (line.StartsWith ("msgid ")) { if (msgid == null && msgstr != null) throw new FormatException ("Found 2 consecutive msgid. Line: " + line_num); if (msgstr != null) { - data.Add (msgid, msgstr); + if (!ignoreNext) + data.Add (msgid, msgstr); + + ignoreNext = false; msgid = null; msgstr = null; } @@ -340,7 +361,8 @@ class PoResourceReader : IResourceReader { if (msgstr == null) throw new FormatException ("Expecting msgstr. Line: " + line_num); - data.Add (msgid, msgstr); + if (!ignoreNext) + data.Add (msgid, msgstr); } } -- 2.25.1