@@ -44,27 +44,27 @@ def usage(code, msg=''):
4444 sys .exit (code )
4545
4646
47- def add (MESSAGES , ctxt , id , str , fuzzy ):
47+ def add (messages , ctxt , id , str , fuzzy ):
4848 "Add a non-fuzzy translation to the dictionary."
4949 if not fuzzy and str :
5050 if ctxt is None :
51- MESSAGES [id ] = str
51+ messages [id ] = str
5252 else :
53- MESSAGES [b"%b\x04 %b" % (ctxt , id )] = str
53+ messages [b"%b\x04 %b" % (ctxt , id )] = str
5454
5555
56- def generate (MESSAGES ):
56+ def generate (messages ):
5757 "Return the generated output."
5858 # the keys are sorted in the .mo file
59- keys = sorted (MESSAGES .keys ())
59+ keys = sorted (messages .keys ())
6060 offsets = []
6161 ids = strs = b''
6262 for id in keys :
6363 # For each string, we need size and file offset. Each string is NUL
6464 # terminated; the NUL does not count into the size.
65- offsets .append ((len (ids ), len (id ), len (strs ), len (MESSAGES [id ])))
65+ offsets .append ((len (ids ), len (id ), len (strs ), len (messages [id ])))
6666 ids += id + b'\0 '
67- strs += MESSAGES [id ] + b'\0 '
67+ strs += messages [id ] + b'\0 '
6868 output = ''
6969 # The header is 7 32-bit unsigned integers. We don't use hash tables, so
7070 # the keys start right after the index tables.
@@ -94,7 +94,7 @@ def generate(MESSAGES):
9494
9595
9696def make (filename , outfile ):
97- MESSAGES = {}
97+ messages = {}
9898 ID = 1
9999 STR = 2
100100 CTXT = 3
@@ -136,7 +136,7 @@ def make(filename, outfile):
136136 lno += 1
137137 # If we get a comment line after a msgstr, this is a new entry
138138 if l [0 ] == '#' and section == STR :
139- add (MESSAGES , msgctxt , msgid , msgstr , fuzzy )
139+ add (messages , msgctxt , msgid , msgstr , fuzzy )
140140 section = msgctxt = None
141141 fuzzy = 0
142142 # Record a fuzzy mark
@@ -148,7 +148,7 @@ def make(filename, outfile):
148148 # Now we are in a msgid or msgctxt section, output previous section
149149 if l .startswith ('msgctxt' ):
150150 if section == STR :
151- add (MESSAGES , msgctxt , msgid , msgstr , fuzzy )
151+ add (messages , msgctxt , msgid , msgstr , fuzzy )
152152 section = CTXT
153153 l = l [7 :]
154154 msgctxt = b''
@@ -165,7 +165,7 @@ def make(filename, outfile):
165165 charset = p .parsestr (msgstr .decode (encoding )).get_content_charset ()
166166 if charset :
167167 encoding = charset
168- add (MESSAGES , msgctxt , msgid , msgstr , fuzzy )
168+ add (messages , msgctxt , msgid , msgstr , fuzzy )
169169 msgctxt = None
170170 section = ID
171171 l = l [5 :]
@@ -215,10 +215,10 @@ def make(filename, outfile):
215215 sys .exit (1 )
216216 # Add last entry
217217 if section == STR :
218- add (MESSAGES , msgctxt , msgid , msgstr , fuzzy )
218+ add (messages , msgctxt , msgid , msgstr , fuzzy )
219219
220220 # Compute output
221- output = generate (MESSAGES )
221+ output = generate (messages )
222222
223223 try :
224224 with open (outfile ,"wb" ) as f :
0 commit comments