
    dfr                        d dl Z d dlZd dlZd dlZd dlmZ d dlmZ d dlm	Z	 d dl
Z
d dlmZ d dlmZ d dlmZ d dlmZmZ d d	lmZmZmZmZ d d
lmZ d dlmZ d dlmZ d dlm Z  d dl!m"Z" d dl#m$Z$  e dej%        ej&        z            Z'd Z( e)            Z*d Z+d Z,e G d d                      Z- G d d          Z.d Z/d Z0 G d de          Z1dS )    N)total_ordering)	dropwhile)Path)settings)ImproperlyConfigured)NamedTemporaryFile)BaseCommandCommandError)find_commandhandle_extensionsis_ignored_pathpopen_wrapper)DEFAULT_LOCALE_ENCODING)cached_property)prepare_js_for_gettext)_lazy_re_compile)get_text_list)
templatizez$^(?P<value>"Plural-Forms.+?\\n")\s*$c                  R    | D ]#}t          |          t          d|z            $d S )NzLCan't find %s. Make sure you have GNU gettext tools 0.15 or newer installed.)r   r
   )programsprograms     hD:\Python Project\djangoTemplates\venv\Lib\site-packages\django/core/management/commands/makemessages.pycheck_programsr   "   sM        (#%,-   )     c                 V    t          j        d|           pt          j        d|           S )Nz^[a-z]+$z^[a-z]+_[A-Z].*$)rematch)locales    r   is_valid_localer   +   s&    8K((QBH5H&,Q,QQr   c                   <    e Zd Zd Zd Zd Zd Zed             ZdS )TranslatableFilec                 0    || _         || _        || _        d S N)filedirpath
locale_dir)selfr%   	file_namer&   s       r   __init__zTranslatableFile.__init__1   s    	$r   c                 z    d| j         j        dt          j                            | j        | j        g          dS )N<z: >)	__class____name__ossepjoinr%   r$   r'   s    r   __repr__zTranslatableFile.__repr__6   s<     N###FKKty12222
 	
r   c                 "    | j         |j         k    S r#   pathr'   others     r   __eq__zTranslatableFile.__eq__<   s    yEJ&&r   c                 "    | j         |j         k     S r#   r5   r7   s     r   __lt__zTranslatableFile.__lt__?   s    y5:%%r   c                 V    t           j                            | j        | j                  S r#   )r/   r6   r1   r%   r$   r2   s    r   r6   zTranslatableFile.pathB   s    w||DL$)444r   N)	r.   
__module____qualname__r)   r3   r9   r;   propertyr6    r   r   r!   r!   /   sk        % % %

 
 
' ' '& & & 5 5 X5 5 5r   r!   c                   l    e Zd ZdZd Zed             Zed             Zed             Zd Z	d Z
d Zd	S )
	BuildFilezN
    Represent the state of a translatable file during the build process.
    c                 0    || _         || _        || _        d S r#   )commanddomaintranslatable)r'   rD   rE   rF   s       r   r)   zBuildFile.__init__L   s    (r   c                     | j         dk    r| j        j        dk     S | j         dk    r5t          j                            | j        j                  d         }|dk    S dS )Ndjangojs)r         django   z.pyF)rE   rD   gettext_versionr/   r6   splitextrF   r$   )r'   file_exts     r   is_templatizedzBuildFile.is_templatizedQ   s\    ;*$$</*<<[H$$w''(9(>??BHu$$ur   c                     | j         j        S r#   )rF   r6   r2   s    r   r6   zBuildFile.pathZ   s     %%r   c                     | j         s| j        S ddd                    | j                  }| j        j        d|}t          j                            | j        j        |          S )z
        Path to a file which is being fed into GNU gettext pipeline. This may
        be either a translatable or its preprocessed version.
        cpyrH   rK   .)	rP   r6   getrE   rF   r$   r/   r1   r%   )r'   	extensionfilenames      r   	work_pathzBuildFile.work_path^   ss     " 	9
 
 #dk

 	 #/444ii@w||D-5x@@@r   c                    | j         sdS t          | j        d          5 }|                                }ddd           n# 1 swxY w Y   | j        dk    rt          |          }n)| j        dk    rt          || j        dd                   }t          | j        dd          5 }|                    |           ddd           dS # 1 swxY w Y   dS )	zz
        Preprocess (if necessary) a translatable file before passing it to
        xgettext GNU gettext utility.
        Nutf-8encodingrH   rK      )originw)	rP   openr6   readrE   r   r   rZ   write)r'   fpsrc_datacontents       r   
preprocesszBuildFile.preprocessm   sY   
 " 	F$)g... 	!"wwyyH	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! 	! ;*$$,X66GG[H$$ $)ABB-@@@G$.#888 	BHHW	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s#   AAA'C

CCc                    | j         s|S t          j        dk    r| j        | j        n| j        dd         | j        dd         t          j        dt          j                  z   dz   fd|t
          j                  S )z
        Postprocess messages generated by xgettext GNU gettext utility.

        Transform paths as if these messages were generated from original
        translatable files rather than from preprocessed versions.
        ntr_   Nz	^(#: .*)()c                 <    | d                                        S )Nr   )replace)r   new_pathold_paths    r   <lambda>z0BuildFile.postprocess_messages.<locals>.<lambda>   s    %(**8X>> r   )flags)	rP   r/   namerZ   r6   r   subescape	MULTILINE)r'   msgsrn   ro   s     @@r   postprocess_messageszBuildFile.postprocess_messages   s     " 	K 7d??~HyHH~abb)Hy}Hv29X...5>>>>>,	
 
 
 	
r   c                     | j         r?t          j                            | j                  rt          j        | j                   dS dS dS )zM
        Remove a preprocessed copy of a translatable file (if any).
        N)rP   r/   r6   existsrZ   unlinkr2   s    r   cleanupzBuildFile.cleanup   sU      	* w~~dn-- *	$.)))))	* 	** *r   N)r.   r=   r>   __doc__r)   r   rP   r6   rZ   rh   rw   r{   r@   r   r   rB   rB   G   s         ) ) )
   _ & & _& A A _A  &
 
 
4	* 	* 	* 	* 	*r   rB   c                     |                                  }|r|d         r|                    d           d                    |          S )a  
    Take a block of raw text that will be passed through str.splitlines() to
    get universal newlines treatment.

    Return the resulting block of text with normalized `
` EOL sequences ready
    to be written to disk using current platform's native EOLs.
     
)
splitlinesappendr1   )raw_contents
lines_lists     r   normalize_eolsr      sN     ((**J jn "99Z   r   c                    |                                 }t          j                            |           rt	          t
          |          }nGg }d\  }}|D ]=}|s|sd|v rd}|                    dd          }|s|sd}|                    |           >d                    |          }t          | ddd          5 }|
                    |           d	d	d	           d	S # 1 swxY w Y   d	S )
z\
    Write the `potfile` with the `msgs` contents, making sure its format is
    valid.
    )FFzcharset=CHARSETTzcharset=UTF-8r   ar\   )r^   newlineN)r   r/   r6   ry   r   lenrm   r   r1   rb   rd   )potfilerv   	pot_lineslinesfoundheader_readlinere   s           r   write_pot_filer      sP   
 !!I	w~~g #y))){ 	 	D L L$,, E<<(9?KKD # #"LL99UD 
gsWd	;	;	; r
                 s   9CC #C c                       e Zd ZdZeZeZg Zg dZ	dgZ
dgZddgZd Zd Zed	             Zed
             Zd Zd Zd Zd Zd Zd Zd ZdS )CommandaH  Runs over the entire source tree of the current directory and pulls out all strings marked for translation. It creates (or updates) a message file in the conf/locale (in the django tree) or locale (for projects and applications) directory.

You must run this command with one of either the --locale, --exclude, or --all options.)z-qz--backup=nonez
--previousz--updatez--to-code=utf-8--no-obsoletez--from-code=UTF-8z--add-comments=Translatorsc           	         |                     ddg dd           |                     ddg dd           |                     d	d
dd           |                     dddd           |                     ddddd           |                     dddd           |                     ddddg dd            |                     d!d"d#d$%           |                     d&dd'           |                     d(dd)           |                     d*d+d,d-d./           |                     d0dd1           |                     d2dd3           d S )4Nz--localez-lr   zfCreates or updates the message files for the given locale(s) (e.g. pt_BR). Can be used multiple times.)defaultactionhelpz	--excludez-xz@Locales to exclude. Default is none. Can be used multiple times.z--domain-drK   z4The domain of the message files (default: "django").)r   r   z--allz-a
store_truez3Updates the message files for all existing locales.)r   r   z--extensionz-e
extensionszThe file extension(s) to examine (default: "html,txt,py", or "js" if the domain is "djangojs"). Separate multiple extensions with commas, or use -e multiple times.)destr   r   z
--symlinksz-szaFollows symlinks to directories when examining source code and templates for translation strings.z--ignorez-iignore_patternsPATTERNz`Ignore files or directories matching this glob-style pattern. Use multiple times to ignore more.)r   r   r   metavarr   z--no-default-ignorestore_falseuse_default_ignore_patternszJDon't ignore the common glob-style patterns 'CVS', '.*', '*~' and '*.pyc'.)r   r   r   	--no-wrapz2Don't break long message lines into several lines.--no-locationz%Don't write '#: filename:line' lines.z--add-location)fullr$   neverr   ?a'  Controls '#: filename:line' lines. If the option is 'full' (the default if not given), the lines  include both file name and line number. If it's 'file', the line number is omitted. If it's 'never', the lines are suppressed (same as --no-location). --add-location requires gettext 0.19 or newer.)choicesconstnargsr   r   z Remove obsolete message strings.z
--keep-potz<Keep .pot file after making messages. Useful when debugging.)add_argument)r'   parsers     r   add_argumentszCommand.add_arguments   sO   6 	 		
 		
 		
 	S 	 	
 	
 	
 	G	 	 	
 	
 	
 	F	 	 	
 	
 	
 	0 	 	
 	
 	
 	5	 	 	
 	
 	
 	"1 	 		
 		
 		
 	! . 	 	
 	
 	
 	E 	 	
 	
 	

 	8 	 	
 	
 	

 	-A 	 	
 	
 	
 	3 	 	
 	
 	

 	O 	 	
 	
 	
 	
 	
r   c                    |d         }|d         }|d         | _         |d         | _        |d         }|d         }|d         | _        |d         }|d	         r|g d
z  }t          t	          |                    | _        |d         r`| j        d d          dgz   | _        | j        d d          dgz   | _        | j        d d          dgz   | _        | j	        d d          dgz   | _	        |d         r`| j        d d          dgz   | _        | j        d d          dgz   | _        | j        d d          dgz   | _        | j	        d d          dgz   | _	        |d         r| j
        dk     r4t          dd                    d | j
        D                       z            d|d         z  }| j        d d          |gz   | _        | j        d d          |gz   | _        | j        d d          |gz   | _        | j	        d d          |gz   | _	        |d         | _        |d         | _        | j         dvrt          d          | j         dk    r|pdg}	n|pg d}	t          |	          | _        |s|s|r| j         St          dt"          j                            t(          j        d                   dt(          j        d         d           | j        dk    r=| j                            d!t1          t          | j                  d"          z             d#| _        g | _        d | _        t"          j                            t"          j                            d$d                    rwt"          j                            t"          j                            d$d                    g| _        | j        d         | _        | j                            d%           d&| _        n| j        r$| j                             tB          j"                   t"          j                            d          r7| j                            t"          j                            d                     | j        r-| j        d         | _        t#          j#        | j        d&'           tI          j%        d(          tM          t"          j        j        tO          j'        d)| j        z                      }
fd*tQ          t"          j        j        |
          D             }|r|}n&|p|}t	          |          )                    |          }|rtU          d+d,d-           tU          d.           	 | +                                }|D ]8}tY          |          stI          j-        d/|          }|ri|.                                }|d0         /                                }|d1         d d2         0                                |d1         d2d          z   }| d3| }n|/                                }tY          |          r"| j                            d4|d5|d6           n| j                            d7|z             | j        dk    r| j                            d8|z             |D ]}| 1                    ||           :	 | j        s| 2                                 d S d S # | j        s| 2                                 w w xY w)9Nr   excluderE   	verbosityallr   symlinksr   r   )CVSz.*z*~z*.pycno_wrapr   no_locationr   add_location)r      zFThe --add-location option requires gettext 0.19 or later. You have %s.rV   c              3   4   K   | ]}t          |          V  d S r#   )str).0xs     r   	<genexpr>z!Command.handle.<locals>.<genexpr>c  s(      -S-Sc!ff-S-S-S-S-S-Sr   z--add-location=%sno_obsoletekeep_pot)rK   rH   zDcurrently makemessages only supports domains 'django' and 'djangojs'rH   js)htmltxtrT   zType 'r   z help rL   z' for usage information.z'examining files with the extensions: %sandFconfzviews/templates/i18n_catalog.jsTexist_okz[a-z]{2}z%s/*c                 >    g | ]}                     |          |S r@   )r   )r   	lang_codelooks_like_locales     r   
<listcomp>z"Command.handle.<locals>.<listcomp>  s=     
 
 
 &&y11

 
 
r   msguniqmsgmerge	msgattribxgettextzB^(?P<language>[a-zA-Z]+)(?P<separator>[^a-zA-Z])(?P<territory>.+)$language	territoryr_   _zinvalid locale z, did you mean r   zinvalid locale %szprocessing locale %s)3rE   r   r   listsetr   msgmerge_optionsmsguniq_optionsmsgattrib_optionsxgettext_optionsrM   r
   r1   r   r   r   r   r/   r6   basenamesysargvstdoutrd   r   invoked_for_djangolocale_pathsdefault_locale_pathisdirabspathr   settings_availableextendr   LOCALE_PATHSmakedirsr   compilefilterglobmap
differencer   build_potfilesr   r   	groupdictlowerupperwrite_po_fileremove_potfiles)r'   argsoptionsr   r   process_allr   r   arg_add_locationextslocale_dirsall_localeslocalespotfilesr   locale_partsr   r   proposed_localer   r   s                       @r   handlezCommand.handleF  s   ")$h' -en\*

+!"3401 	<;;;;O#C$8$899 9 	M$($9!!!$<}$LD!#'#7#:k]#JD %)%;AAA%>+%ND"$($9!!!$<}$LD!=! 	Q$($9!!!$<?P$PD!#'#7#:o=N#ND %)%;AAA%>/AR%RD"$($9!!!$<?P$PD!>" 
	R#g--"#%(XX-S-Sd>R-S-S-S%S%ST    3W^5LL$($9!!!$<@P?Q$QD!#'#7#:>N=O#OD %)%;AAA%>BRAS%SD"$($9!!!$<@P?Q$QD!"=1
+;444*   ;*$$'$DD6!6!6!6D+D11 	w 	{ 	t{?R,7##CHQK0000#(1+++?  
 >AK9T_ 5 5u==>  
 #(#' 7==fh7788 	E!#fh1O1O!P!P QD'+'8';D$ ''(IJJJ&*D##& @!(()>???w}}X&& D!(()B)BCCC  E+/+<Q+?(D4tDDDD J{33GM49Vd.F%FGG
 

 
 
 
 !1;??
 
 
  	7!GG+G'll--g66G 	?9j+>>>z"""/	'**,,H " (8 (8&v.. #
 H. 	 E  
9','8'8#/
#;#A#A#C#C(5bqb9??AA*;7;< " .6*C*C	*C*C +1,,.. '77 	H))) !' /    ))*=*FGGG>A%%K%%&<v&EFFF' 8 8G&&w77778O(8T = '$$&&&&&' '4= '$$&&&&'s   EZ< <[c                     t          ddgt                    \  }}}t          j        d|          }|r+t	          d |                                D                       S t          d          )Nr   z	--version)stdout_encodingz(\d+)\.(\d+)\.?(\d+)?c              3   8   K   | ]}|t          |          V  d S r#   )int)r   ds     r   r   z*Command.gettext_version.<locals>.<genexpr>  s(      EEAq}Q}}}}EEr   z/Unable to get gettext version. Is it installed?)r   r   r   searchtuplegroupsr
   )r'   outerrstatusms        r   rM   zCommand.gettext_version  s{     )%3
 
 
S& I.44 	REEEEEEEEPQQQr   c                     	 t           j         n6# t          $ r) | j        dk    r| j                            d           Y dS w xY wdS )NrL   z$Running without configured settings.FT)r   r   r   r   stderrrd   r2   s    r   r   zCommand.settings_available  s`    	!!!# 	 	 	~!!!!"HIII55	 ts    /AAc                    |                      d          }|                                  |                     |           g }| j        D ]}t          j                            |d| j        z            }t          j                            |          sKdg| j	        z   |gz   }t          |          \  }}}|rB|t          k    rt          d|z            | j        dk    r| j                            |           t!          |          }t#          |dd          5 }	|	                    |           d	d	d	           n# 1 swxY w Y   |                    |           |S )
z<
        Build pot files and apply msguniq to them.
        rV   %s.potr   z(errors happened while running msguniq
%sr   ra   r\   r]   N)
find_filesr   process_filesr   r/   r6   r1   rE   ry   r   r   	STATUS_OKr
   r   r   rd   r   rb   r   )
r'   	file_listr   r6   r   r   rv   errorsr  re   s
             r   r   zCommand.build_potfiles  s    OOC((	9%%%% 	% 	%Dgll4DK)?@@G7>>'** ;!55	AD#0#6#6 D&& .Y&&&CfL   ^a''K%%f---!$''DgsW555               OOG$$$$s   D<<E 	E 	c                     | j         D ]]}t          j                            |d| j        z            }t          j                            |          rt          j        |           ^d S )Nr  )r   r/   r6   r1   rE   ry   rz   )r'   r6   pot_paths      r   r   zCommand.remove_potfiles  sa    % 	$ 	$Dw||D(T[*@AAHw~~h'' $	(###	$ 	$r   c           
         g }g }| j         r"d t          j        t          j        fD             }t	          j        |d| j                  D ]\  }}}|dd         D ]A}t          t          j        	                    t          j        
                    ||                    | j                  s?t          j        
                    t          j                            |          |          |v r>|                    |           | j        dk    r| j                            d|z             |dk    rk|                    |           | j                            dt          j        
                    t          j                            |          |                     C|D ]H}t          j        	                    t          j        
                    ||                    }	t          j                            |          d         }
|
| j        vst          |	| j                  r,| j        dk    r | j                            d	|d
|           d}| j        D ]U}t          j                            |                              t          j                            |                    r|} nV|p| j        pt0          }|                    |                     |||                     Jt7          |          S )zx
        Get all files in the given root. Also check that there is a matching
        locale dir for each file.
        c                 P    g | ]#}|t           j                            |          $S r@   )r/   r6   normpath)r   ps     r   r   z&Command.find_files.<locals>.<listcomp>   s>         ##  r   T)topdownfollowlinksNrL   zignoring directory %sr   r   zignoring file  in )r   r   
MEDIA_ROOTSTATIC_ROOTr/   walkr   r   r6   r  r1   r   r   remover   r   rd   r   insertrN   r   
startswithdirnamer   NO_LOCALE_DIRr   translatable_file_classsorted)r'   root	all_filesignored_rootsr%   dirnames	filenamesr  rY   	file_pathrO   r&   r6   s                r   r	  zCommand.find_files  s   
 	" 	 "-x/CD  M
 -/G$DM-
 -
 -
 &	 &	(GXy $AAA;  #((gw)G)GHH, 
 w||BGOOG$<$<gFF-WWOOG,,,~))))*AG*KLLL((OOG,,,%,,27<<(@(@'JJ   &  G,,RW\\'8-L-LMM	7++H55a84?22ot37 72 ~)))))8@''J   "&J $ 1 " "7??733>>rwt?T?TUU ")-J!E" ",!Xt/G!X=J$$44Wh
SS   #( i   r   c                     i }|D ]2}|                     |j        g           }|                    |           3|                                D ]\  }}|                     ||           dS )zu
        Group translatable files by locale directory and run pot file build
        process for each group.
        N)
setdefaultr&   r   itemsprocess_locale_dir)r'   r  file_groupsrF   
file_groupr&   filess          r   r
  zCommand.process_filesN  s    
 % 	, 	,L$//0GLLJl++++!,!2!2!4!4 	7 	7J##J6666	7 	7r   c                 v   g }|D ]}| j         dk    r*| j                            d|j        d|j                   | j        dvrA|                     | | j        |          }	 |                                 nh# t          $ r8}| j                            d|j        d|j        d|d           Y d}~d}~wt          $ r |D ]}|
                                  w xY w|                    |           | j        d	k    r |j        }d
d| j        d|rdndddddddg
}n!| j        dk    rd
d| j        dddddddddg}ndS d |D             }	t          d          5 }
|
                    d                    |	                     |
                                 |                    d|
j        g           |                    | j                   t'          |          \  }}}ddd           n# 1 swxY w Y   |rq|t(          k    rA|D ]}|
                                 t+          dd                    |	          d|          | j         dk    r| j                            |           |r|t,          u rU|D ]}|
                                 t.          j                            |d         j                  }t+          d |z            |D ]}|                    |          }t.          j                            |d!| j        z            }t7          ||           |D ]}|
                                 dS )"z
        Extract translatable literals from the specified files, creating or
        updating the POT file for a given locale directory.

        Use the xgettext GNU gettext utility.
        rL   zprocessing file r  rU   z!UnicodeDecodeError: skipped file z
 (reason: rk   NrH   r   r   z--language=C
JavaScriptz--keyword=gettext_noopz--keyword=gettext_lazyz--keyword=ngettext_lazy:1,2z--keyword=pgettext:1c,2z--keyword=npgettext:1c,2,3z
--output=-rK   z--language=Pythonz--keyword=pgettext_lazy:1c,2z--keyword=npgettext_lazy:1c,2,3c                     g | ]	}|j         
S r@   )rZ   )r   bfs     r   r   z.Command.process_locale_dir.<locals>.<listcomp>  s    :::r|:::r   zw+)moder   z--files-fromz*errors happened while running xgettext on r   zUnable to find a locale path to store translations for file %s. Make sure the 'locale' directory exists in an app or LOCALE_PATHS setting is set.r  )r   r   rd   r$   r%   rE   build_file_classrh   UnicodeDecodeErrorBaseExceptionr{   r   rP   r   r1   flushr   rr   r   r   r  r
   r  r/   r6   r  rw   r   )r'   r&   r-  build_filesrF   
build_fileerP   r   input_filesinput_files_listrv   r  r  r&  r   s                   r   r*  zCommand.process_locale_dirZ  sg    ! 	+ 	+L~!!!!!#(((,*>*>@   {"888..tT[,OOJ%%''''% 	 	 	!!! %)))$,,,	       "- ) )J&&((((	
 z****;*$$'6N*8#J33l#JL((-),DD [H$$#((-),.1DD F::k:::T*** 	7.>""499[#9#9:::""$$$KK)9)>?@@@KK-...#0#6#6 D&&	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7 	7  
	*"""- ) )J&&(((("lyy----vv7   !##!!&))) 	*]**"- ) )J&&((((G,,[^-@AA	":<EF  
 * = =
!66t<<gll:x$+/EFFG7D)))% 	! 	!J    	! 	!s+   #A88
C.B55(CBG00G47G4c                    t           j                            t           j                            |          |d          }t          j        |d           t           j                            |d| j        z            }t           j                            |          rdg| j        z   ||gz   }t          |          \  }}}|rB|t          k    rt          d|z            | j        dk    r| j                            |           t          |                              d	          }	nZt!          |d	          5 }
|
                                }	d
d
d
           n# 1 swxY w Y   | j        s|                     |	|          }	t)          |	          }	|	                    d| j        z  d          }	t!          |dd	          5 }
|
                    |	           d
d
d
           n# 1 swxY w Y   | j        rjdg| j        z   d||gz   }t          |          \  }	}}|rF|t          k    rt          d|z            | j        dk    r | j                            |           d
S d
S d
S d
S )z
        Create or update the PO file for self.domain and `locale`.
        Use contents of the existing `potfile`.

        Use msgmerge and msgattrib GNU gettext utilities.
        LC_MESSAGESTr   %s.por   z)errors happened while running msgmerge
%sr   r\   r]   Nz2#. #-#-#-#-#  %s.pot (PACKAGE VERSION)  #-#-#-#-#
r   ra   r   z-oz*errors happened while running msgattrib
%s)r/   r6   r1   r  r   rE   ry   r   r   r  r
   r   r   rd   r   	read_textrb   rc   r   copy_plural_formsr   rm   r   r   )r'   r   r   basedirpofiler   r   r  r  rv   re   s              r   r   zCommand.write_po_file  s    ',,rww77OO
Gd++++gw'<==7>>&!! 	<<$"7767:KKD -d 3 3Avv .Y&&&DvM   ^a''K%%f---<<))7);;DDg000 !Bwwyy! ! ! ! ! ! ! ! ! ! ! ! ! ! !* <--dF;;d##||ADKOQS
 
 &#000 	BHHTNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	  		.=4#99T66<RRD#0#6#6 D&& .Y&&&EN   ^a''K%%f-----		. 		.. .
 ('s$   8EE E G""G&)G&c           
      f   t           j                            t           j                            t           j                            t
          j                                      }| j        dk    rd}nd}|D ]9}t           j                            |dd|dd|z            }t           j                            |          rt          |d	          5 }t                              |                                          }d
d
d
           n# 1 swxY w Y   |r|d         }	| j        dk    r| j                            d|	z             g }
d}|                                D ]9}|s |rt                              |          r|	}d}|
                    |           :d                    |
          } n;|S )z
        Copy plural forms header contents from a Django catalog of locale to
        the msgs string, inserting it at the right place. msgs should be the
        contents of a newly created .po file.
        rH   rU   )rK   r   r   r>  r?  r\   r]   NvaluerL   zcopying plural forms: %sFTr   )r/   r6   r  r1   r  rK   __file__rE   ry   rb   plural_forms_rer   rc   r   r   rd   r   r   )r'   rv   r   
django_dirdomainsrE   	django_pore   r  plural_form_liner   r   r   s                r   rA  zCommand.copy_plural_forms  s    W%%bgll27??6?3S3S&T&TUU
;*$$,GG!G 	 	FFHfmWvEU I w~~i(( )g666 :"'..rwwyy99A: : : : : : : : : : : : : : : '(z$~))))*DGW*WXXXE!E $ 1 1 + +$ )d )o6L6LT6R6R )#3D$(ET****99U++DEs   -D		D	D	N)r.   r=   r>   r   r!   r  rB   r4  requires_system_checksr   r   r   r   r   r   r   rM   r   r   r   r	  r
  r*  r   rA  r@   r   r   r   r      s)       	' 	 / HHH()O()+-IJa
 a
 a
FW' W' W'r R R _R   _  6$ $ $4! 4! 4!l
7 
7 
7h! h! h!T+. +. +.Z    r   r   )2r   r/   r   r   	functoolsr   	itertoolsr   pathlibr   rK   django.confr   django.core.exceptionsr   django.core.files.tempr   django.core.management.baser	   r
   django.core.management.utilsr   r   r   r   django.utils.encodingr   django.utils.functionalr   django.utils.jslexr   django.utils.regex_helperr   django.utils.textr   django.utils.translationr   ru   DOTALLrG  r  objectr  r   r   r!   rB   r   r   r   r@   r   r   <module>r]     st    				 				 



 $ $ $ $ $ $                          7 7 7 7 7 7 5 5 5 5 5 5 A A A A A A A A            : 9 9 9 9 9 3 3 3 3 3 3 5 5 5 5 5 5 6 6 6 6 6 6 + + + + + + / / / / / /""+R\BI-E  	  R R R 5 5 5 5 5 5 5 5.\* \* \* \* \* \* \* \*~! ! !  6@	 @	 @	 @	 @	k @	 @	 @	 @	 @	r   