diff --git a/gettext.spec b/gettext.spec index ae415cf..24fcc9d 100644 --- a/gettext.spec +++ b/gettext.spec @@ -1,7 +1,7 @@ Summary: GNU libraries and utilities for producing multi-lingual messages. Name: gettext Version: 0.10.38 -Release: 5 +Release: 6 License: GPL Group: Development/Tools Source: ftp://ftp.gnu.org/gnu/gettext/%{name}-%{version}.tar.gz @@ -95,8 +95,21 @@ exit 0 %{_datadir}/gettext %{_datadir}/aclocal/* %{_datadir}/emacs/site-lisp/* +# These aren't in glibc... +%dir /usr/share/locale/en@boldquot +%dir /usr/share/locale/en@boldquot/LC_MESSAGES +%dir /usr/share/locale/en@quot +%dir /usr/share/locale/en@quot/LC_MESSAGES %changelog +* Wed Aug 22 2001 Trond Eivind Glomsrød 0.10.38-6 +- Fix handling of multiline entries (rest of #50065) +- don't use the references of the last entry in a po file +- remove duplicates when inverting +- Own the en@quot and en@boldquot locale dirs (#52164) +- Handle entries with a first line of "" as identical to those + without + * Thu Aug 9 2001 Trond Eivind Glomsrød - Added "--append" and "-o" to msghack, which should address initial concerns in #50065 diff --git a/msghack.py b/msghack.py index 844e018..23408e4 100755 --- a/msghack.py +++ b/msghack.py @@ -2,6 +2,8 @@ ## Copyright (C) 2001 Red Hat, Inc. ## Copyright (C) 2001 Trond Eivind Glomsrød +## v0.2 - 2001-08-21 + ## This program is free software; you can redistribute it and/or modify ## it under the terms of the GNU General Public License as published by ## the Free Software Foundation; either version 2 of the License, or @@ -49,30 +51,38 @@ class GTMessage: res="" for ref in self._refs: res=res+ref+"\n" - res=res+"msgid \"%s\"\nmsgstr \"%s\"\n" % (self._id,self._message) + res=res+"msgid %s\nmsgstr %s\n" % (self._id,self._message) return res def invertedStrings(self): """ - Returns a string representation, but with msgid and msgstr inverted + Returns a string representation, but with msgid and msgstr inverted. + Note: Don't invert the "" string @self The object instance """ res="" for ref in self._refs: res=res+ref+"\n" - res=res+"msgid \"%s\"\nmsgstr \"%s\"\n" % (self._message,self._id) + if not self._id=="\"\"": + res=res+"msgid %s\nmsgstr %s\n" % (self._message,self._id) + else: + res=res+"msgid %s\nmsgstr %s\n" % (self._id,self._message) return res def emptyMsgStrings(self): """ Return a string representation of the object, but leave the msgstr empty - create a pot file from a po file + Note: Won't remove the "" string @self The object instance """ res="" for ref in self._refs: res=res+ref+"\n" - res=res+"msgid \"%s\"\nmsgstr \"\"\n" % (self._id) + if not self._id=="\"\"": + res=res+"msgid %s\nmsgstr \"\"\n" % (self._id) + else: + res=res+"msgid %s\nmsgstr %s\n" % (self._id,self._message) return res def compareMessage(self,msg): @@ -124,9 +134,9 @@ class GTMasterMessage: res="" for ref in self._refs: res=res+ref+"\n" - res=res+"msgid \"%s\"\n" % self._id + res=res+"msgid %s\n" % self._id for message in self._messages: - res=res+"msgstr(%s) \"%s\"\n" %(message[0],message[1]) + res=res+"msgstr(%s) %s\n" %(message[0],message[1]) res=res+"\n" return res @@ -158,17 +168,33 @@ class GTFile: def invertedStrings(self): """ Return a string representation of the object, with msgid and msgstr - swapped + swapped. Will remove duplicates... @self The object instance """ - res="" + + msght={} + msgar=[] + for message in self._messages: - res=res+message.invertedStrings()+"\n" + if message._id=='""' and len(msgar)==0: + msgar.append(GTMessage(message._id,message._message,message._refs)) + continue + msg=GTMessage(message._message,message._id,message._refs) + if not msght.has_key(msg._id): + msght[msg._id]=msg + msgar.append(msg) + else: + msg2=msght[msg._id] + for ref in msg._refs: + msg2._refs.append(ref) + res="" + for message in msgar: + res=res+str(message)+"\n" return res def msgidDupes(self): """ - Search for duplicates among the inverted strings + Search for duplicates in the msgids. @self The object instance """ msgids={} @@ -248,13 +274,18 @@ class GTFile: if inmsgstr==1: if pos==-1: inmsgstr=0 + #Handle entries with and without "" consistently + if msgid[:2]=='""' and len(msgid)>4: + msgid=msgid[2:] + if msgstr[:2]=='""' and len(msgstr)>4: + msgstr=msgstr[2:] message=GTMessage(msgid,msgstr,refs) self._messages.append(message) msgstr="" msgid="" refs=[] else: - msgstr=msgstr+line[pos+1:pos2]+"\n" + msgstr=msgstr+line[pos:pos2+1]+"\n" if inmsgid==0 and line[:5]=="msgid": msgid="" inmsgid=1 @@ -262,9 +293,9 @@ class GTFile: if pos==-1: inmsgid=0 else: - msgid=msgid+line[pos+1:pos2]+"\n" + msgid=msgid+line[pos:pos2+1]+"\n" if msgstr and msgid: - message=GTMessage(msgid,msgstr) + message=GTMessage(msgid,msgstr,refs) self._messages.append(message)