auto-import changelog data from gettext-0.10.38-5.src.rpm
Thu Aug 09 2001 Trond Eivind Glomsrd <teg@redhat.com> - Added "--append" and "-o" to msghack, which should address initial concerns in #50065
This commit is contained in:
parent
2b5159386c
commit
31ff371cd2
11
gettext.spec
11
gettext.spec
@ -1,7 +1,7 @@
|
|||||||
Summary: GNU libraries and utilities for producing multi-lingual messages.
|
Summary: GNU libraries and utilities for producing multi-lingual messages.
|
||||||
Name: gettext
|
Name: gettext
|
||||||
Version: 0.10.38
|
Version: 0.10.38
|
||||||
Release: 4
|
Release: 5
|
||||||
License: GPL
|
License: GPL
|
||||||
Group: Development/Tools
|
Group: Development/Tools
|
||||||
Source: ftp://ftp.gnu.org/gnu/gettext/%{name}-%{version}.tar.gz
|
Source: ftp://ftp.gnu.org/gnu/gettext/%{name}-%{version}.tar.gz
|
||||||
@ -23,17 +23,16 @@ BuildRequires: emacs
|
|||||||
|
|
||||||
%description
|
%description
|
||||||
The GNU gettext package provides a set of tools and documentation for
|
The GNU gettext package provides a set of tools and documentation for
|
||||||
producing multi-lingual messages in programs. Tools include a set of
|
producing multi-lingual messages in programs. Tools include a set of
|
||||||
conventions about how programs should be written to support message
|
conventions about how programs should be written to support message
|
||||||
catalogs, a directory and file naming organization for the message
|
catalogs, a directory and file naming organization for the message
|
||||||
catalogs, a runtime library which supports the retrieval of translated
|
catalogs, a runtime library which supports the retrieval of translated
|
||||||
messages, and stand-alone programs for handling the translatable and
|
messages, and stand-alone programs for handling the translatable and
|
||||||
the already translated strings. Gettext provides an easy to use
|
the already translated strings. Gettext provides an easy to use
|
||||||
library and tools for creating, using, and modifying natural language
|
library and tools for creating, using, and modifying natural language
|
||||||
catalogs and is a powerful and simple method for internationalizing
|
catalogs and is a powerful and simple method for internationalizing
|
||||||
programs.
|
programs.
|
||||||
|
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
rm -rf %{buildroot}
|
rm -rf %{buildroot}
|
||||||
%setup -q
|
%setup -q
|
||||||
@ -98,6 +97,10 @@ exit 0
|
|||||||
%{_datadir}/emacs/site-lisp/*
|
%{_datadir}/emacs/site-lisp/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Aug 9 2001 Trond Eivind Glomsrød <teg@redhat.com>
|
||||||
|
- Added "--append" and "-o" to msghack, which should address
|
||||||
|
initial concerns in #50065
|
||||||
|
|
||||||
* Thu Jul 19 2001 Trond Eivind Glomsrød <teg@redhat.com>
|
* Thu Jul 19 2001 Trond Eivind Glomsrød <teg@redhat.com>
|
||||||
- New msghack - from scratch, in python
|
- New msghack - from scratch, in python
|
||||||
|
|
||||||
|
89
msghack.py
89
msghack.py
@ -20,7 +20,6 @@
|
|||||||
A msghack replacement
|
A msghack replacement
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
import string
|
import string
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
@ -76,6 +75,18 @@ class GTMessage:
|
|||||||
res=res+"msgid \"%s\"\nmsgstr \"\"\n" % (self._id)
|
res=res+"msgid \"%s\"\nmsgstr \"\"\n" % (self._id)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def compareMessage(self,msg):
|
||||||
|
"""
|
||||||
|
Return if the messages have identical msgids, 0 otherwise
|
||||||
|
@self The object instance
|
||||||
|
@msg The message to compare to
|
||||||
|
"""
|
||||||
|
|
||||||
|
if self._id == msg._id:
|
||||||
|
return 1
|
||||||
|
return 0
|
||||||
|
|
||||||
|
|
||||||
class GTMasterMessage:
|
class GTMasterMessage:
|
||||||
"""
|
"""
|
||||||
A class containing a message, its msgid and various references pointing at it
|
A class containing a message, its msgid and various references pointing at it
|
||||||
@ -155,6 +166,21 @@ class GTFile:
|
|||||||
res=res+message.invertedStrings()+"\n"
|
res=res+message.invertedStrings()+"\n"
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def msgidDupes(self):
|
||||||
|
"""
|
||||||
|
Search for duplicates among the inverted strings
|
||||||
|
@self The object instance
|
||||||
|
"""
|
||||||
|
msgids={}
|
||||||
|
res=""
|
||||||
|
for message in self._messages:
|
||||||
|
msgid=message._id
|
||||||
|
if msgids.has_key(msgid):
|
||||||
|
res=res+"Duplicate: %s\n" % (msgid)
|
||||||
|
else:
|
||||||
|
msgids[msgid]=1
|
||||||
|
return res
|
||||||
|
|
||||||
def getMsgstr(self,msgid):
|
def getMsgstr(self,msgid):
|
||||||
"""
|
"""
|
||||||
Return the msgstr matching the given id. 'None' if missing
|
Return the msgstr matching the given id. 'None' if missing
|
||||||
@ -179,6 +205,20 @@ class GTFile:
|
|||||||
res=res+message.emptyMsgStrings()+"\n"
|
res=res+message.emptyMsgStrings()+"\n"
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
|
def append(self,B):
|
||||||
|
"""
|
||||||
|
Append entries from dictionary B which aren't
|
||||||
|
already present in this dictionary
|
||||||
|
@self The object instance
|
||||||
|
@B the dictionary to append messages from
|
||||||
|
"""
|
||||||
|
|
||||||
|
for message in B._messages:
|
||||||
|
if not self.getMsgstr(message._id):
|
||||||
|
self._messages.append(message)
|
||||||
|
|
||||||
|
|
||||||
def readFile(self,filename):
|
def readFile(self,filename):
|
||||||
"""
|
"""
|
||||||
Read the contents of a file into the GTFile object
|
Read the contents of a file into the GTFile object
|
||||||
@ -233,7 +273,6 @@ class GTMaster:
|
|||||||
A class containing a master catalogue of gettext dictionaries
|
A class containing a master catalogue of gettext dictionaries
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
def __init__(self,dicts):
|
def __init__(self,dicts):
|
||||||
"""
|
"""
|
||||||
The constructor for the GTMaster class
|
The constructor for the GTMaster class
|
||||||
@ -271,29 +310,47 @@ class GTMaster:
|
|||||||
for message in self._messages:
|
for message in self._messages:
|
||||||
res=res+str(message)+"\n"
|
res=res+str(message)+"\n"
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
|
||||||
if __name__=="__main__":
|
if __name__=="__main__":
|
||||||
|
output=None
|
||||||
|
res=None
|
||||||
|
if("-o") in sys.argv:
|
||||||
|
output=sys.argv[sys.argv.index("-o")+1]
|
||||||
|
sys.argv.remove("-o")
|
||||||
|
sys.argv.remove(output)
|
||||||
if("--invert") in sys.argv:
|
if("--invert") in sys.argv:
|
||||||
file=sys.argv[sys.argv.index("--invert")+1]
|
file=sys.argv[sys.argv.index("--invert")+1]
|
||||||
gtf=GTFile(file)
|
gtf=GTFile(file)
|
||||||
print gtf.invertedStrings()
|
res1=gtf.msgidDupes()
|
||||||
sys.exit(0)
|
if res1:
|
||||||
if("--empty") in sys.argv:
|
sys.stderr.write(res1)
|
||||||
|
sys.exit(1)
|
||||||
|
res=str(gtf.invertedStrings())
|
||||||
|
elif("--empty") in sys.argv:
|
||||||
file=sys.argv[sys.argv.index("--empty")+1]
|
file=sys.argv[sys.argv.index("--empty")+1]
|
||||||
gtf=GTFile(file)
|
gtf=GTFile(file)
|
||||||
print gtf.emptyMsgStrings()
|
res=str(gtf.emptyMsgStrings())
|
||||||
sys.exit(0)
|
elif("--master") in sys.argv:
|
||||||
if("--master") in sys.argv:
|
|
||||||
loc=sys.argv.index("--master")+1
|
loc=sys.argv.index("--master")+1
|
||||||
gtfs=[]
|
gtfs=[]
|
||||||
for file in sys.argv[loc:]:
|
for file in sys.argv[loc:]:
|
||||||
gtfs.append(GTFile(file))
|
gtfs.append(GTFile(file))
|
||||||
|
|
||||||
master=GTMaster(gtfs)
|
master=GTMaster(gtfs)
|
||||||
print master
|
res=str(master)
|
||||||
sys.exit(0)
|
elif("--append") in sys.argv:
|
||||||
|
file=sys.argv[sys.argv.index("--append")+1]
|
||||||
print "Not implemented: "+`sys.argv`
|
file2=sys.argv[sys.argv.index("--append")+2]
|
||||||
sys.exit(1)
|
gtf=GTFile(file)
|
||||||
|
gtf2=GTFile(file2)
|
||||||
|
gtf.append(gtf2)
|
||||||
|
res=str(gtf)
|
||||||
|
else:
|
||||||
|
print "Not implemented: "+str(sys.argv)
|
||||||
|
sys.exit(1)
|
||||||
|
if not output:
|
||||||
|
print res
|
||||||
|
else:
|
||||||
|
file=open(output,"w")
|
||||||
|
file.write(res)
|
||||||
|
sys.exit(0)
|
||||||
|
Loading…
Reference in New Issue
Block a user