mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 05:31:20 +00:00 
			
		
		
		
	gh-131852: Filter out POT-Creation-Date in msgfmt (GH-131880)
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
This commit is contained in:
		
							parent
							
								
									376631829a
								
							
						
					
					
						commit
						ad6a032ceb
					
				
					 4 changed files with 10 additions and 3 deletions
				
			
		|  | @ -1,7 +1,7 @@ | ||||||
| [ | [ | ||||||
|     [ |     [ | ||||||
|         "", |         "", | ||||||
|         "Project-Id-Version: PACKAGE VERSION\nPOT-Creation-Date: 2024-10-26 18:06+0200\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME <EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE <LL@li.org>\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n" |         "Project-Id-Version: PACKAGE VERSION\nPO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\nLast-Translator: FULL NAME <EMAIL@ADDRESS>\nLanguage-Team: LANGUAGE <LL@li.org>\nMIME-Version: 1.0\nContent-Type: text/plain; charset=UTF-8\nContent-Transfer-Encoding: 8bit\n" | ||||||
|     ], |     ], | ||||||
|     [ |     [ | ||||||
|         "\n newlines \n", |         "\n newlines \n", | ||||||
|  |  | ||||||
										
											Binary file not shown.
										
									
								
							|  | @ -0,0 +1,2 @@ | ||||||
|  | :program:`msgfmt` no longer adds the ``POT-Creation-Date`` to generated ``.mo`` files | ||||||
|  | for consistency with GNU ``msgfmt``. | ||||||
|  | @ -158,14 +158,19 @@ def make(filename, outfile): | ||||||
|             msgctxt = b'' |             msgctxt = b'' | ||||||
|         elif l.startswith('msgid') and not l.startswith('msgid_plural'): |         elif l.startswith('msgid') and not l.startswith('msgid_plural'): | ||||||
|             if section == STR: |             if section == STR: | ||||||
|                 add(msgctxt, msgid, msgstr, fuzzy) |  | ||||||
|                 msgctxt = None |  | ||||||
|                 if not msgid: |                 if not msgid: | ||||||
|  |                     # Filter out POT-Creation-Date | ||||||
|  |                     # See issue #131852 | ||||||
|  |                     msgstr = b''.join(line for line in msgstr.splitlines(True) | ||||||
|  |                                       if not line.startswith(b'POT-Creation-Date:')) | ||||||
|  | 
 | ||||||
|                     # See whether there is an encoding declaration |                     # See whether there is an encoding declaration | ||||||
|                     p = HeaderParser() |                     p = HeaderParser() | ||||||
|                     charset = p.parsestr(msgstr.decode(encoding)).get_content_charset() |                     charset = p.parsestr(msgstr.decode(encoding)).get_content_charset() | ||||||
|                     if charset: |                     if charset: | ||||||
|                         encoding = charset |                         encoding = charset | ||||||
|  |                 add(msgctxt, msgid, msgstr, fuzzy) | ||||||
|  |                 msgctxt = None | ||||||
|             section = ID |             section = ID | ||||||
|             l = l[5:] |             l = l[5:] | ||||||
|             msgid = msgstr = b'' |             msgid = msgstr = b'' | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Stan Ulbrych
						Stan Ulbrych