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.
|
||||
Name: gettext
|
||||
Version: 0.10.38
|
||||
Release: 4
|
||||
Release: 5
|
||||
License: GPL
|
||||
Group: Development/Tools
|
||||
Source: ftp://ftp.gnu.org/gnu/gettext/%{name}-%{version}.tar.gz
|
||||
@ -23,17 +23,16 @@ BuildRequires: emacs
|
||||
|
||||
%description
|
||||
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
|
||||
catalogs, a directory and file naming organization for the message
|
||||
catalogs, a runtime library which supports the retrieval of translated
|
||||
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
|
||||
catalogs and is a powerful and simple method for internationalizing
|
||||
programs.
|
||||
|
||||
|
||||
%prep
|
||||
rm -rf %{buildroot}
|
||||
%setup -q
|
||||
@ -98,6 +97,10 @@ exit 0
|
||||
%{_datadir}/emacs/site-lisp/*
|
||||
|
||||
%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>
|
||||
- New msghack - from scratch, in python
|
||||
|
||||
|
89
msghack.py
89
msghack.py
@ -20,7 +20,6 @@
|
||||
A msghack replacement
|
||||
"""
|
||||
|
||||
|
||||
import string
|
||||
import sys
|
||||
|
||||
@ -76,6 +75,18 @@ class GTMessage:
|
||||
res=res+"msgid \"%s\"\nmsgstr \"\"\n" % (self._id)
|
||||
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:
|
||||
"""
|
||||
A class containing a message, its msgid and various references pointing at it
|
||||
@ -155,6 +166,21 @@ class GTFile:
|
||||
res=res+message.invertedStrings()+"\n"
|
||||
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):
|
||||
"""
|
||||
Return the msgstr matching the given id. 'None' if missing
|
||||
@ -179,6 +205,20 @@ class GTFile:
|
||||
res=res+message.emptyMsgStrings()+"\n"
|
||||
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):
|
||||
"""
|
||||
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
|
||||
"""
|
||||
|
||||
|
||||
def __init__(self,dicts):
|
||||
"""
|
||||
The constructor for the GTMaster class
|
||||
@ -271,29 +310,47 @@ class GTMaster:
|
||||
for message in self._messages:
|
||||
res=res+str(message)+"\n"
|
||||
return res
|
||||
|
||||
|
||||
|
||||
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:
|
||||
file=sys.argv[sys.argv.index("--invert")+1]
|
||||
gtf=GTFile(file)
|
||||
print gtf.invertedStrings()
|
||||
sys.exit(0)
|
||||
if("--empty") in sys.argv:
|
||||
res1=gtf.msgidDupes()
|
||||
if res1:
|
||||
sys.stderr.write(res1)
|
||||
sys.exit(1)
|
||||
res=str(gtf.invertedStrings())
|
||||
elif("--empty") in sys.argv:
|
||||
file=sys.argv[sys.argv.index("--empty")+1]
|
||||
gtf=GTFile(file)
|
||||
print gtf.emptyMsgStrings()
|
||||
sys.exit(0)
|
||||
if("--master") in sys.argv:
|
||||
res=str(gtf.emptyMsgStrings())
|
||||
elif("--master") in sys.argv:
|
||||
loc=sys.argv.index("--master")+1
|
||||
gtfs=[]
|
||||
for file in sys.argv[loc:]:
|
||||
gtfs.append(GTFile(file))
|
||||
|
||||
master=GTMaster(gtfs)
|
||||
print master
|
||||
sys.exit(0)
|
||||
|
||||
print "Not implemented: "+`sys.argv`
|
||||
sys.exit(1)
|
||||
|
||||
res=str(master)
|
||||
elif("--append") in sys.argv:
|
||||
file=sys.argv[sys.argv.index("--append")+1]
|
||||
file2=sys.argv[sys.argv.index("--append")+2]
|
||||
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