
    LȂiq                        S SK r S SKrS SKrS SKrS SKJr  S SKJr  S SKJ	r	  S SK
r
S SKJr  S SKJr  S SKJr  S SKJrJr  S S	KJrJrJrJr  S S
KJr  S SKJr  S SKJr  S SKJ r   S SK!J"r"  \" S\RF                  \RH                  -  5      r%S r&\'" 5       r(S r)S r*\ " S S5      5       r+ " S S5      r,S r-S r. " S S\5      r/g)    N)total_ordering)	dropwhile)Path)settings)ImproperlyConfigured)NamedTemporaryFile)BaseCommandCommandError)find_commandhandle_extensionsis_ignored_pathpopen_wrapper)DEFAULT_LOCALE_ENCODING)cached_property)_lazy_re_compile)get_text_list)
templatizez$^(?P<value>"Plural-Forms.+?\\n")\s*$c                  L    U  H  n[        U5      b  M  [        SU S35      e   g )NzCan't find z?. Make sure you have GNU gettext tools 0.19 or newer installed.)r   r
   )programsprograms     ]D:\sksbv-state-backend\venv\Lib\site-packages\django/core/management/commands/makemessages.pycheck_programsr   !   s5     (gY '+ +      c                 l    [         R                  " SU 5      =(       d    [         R                  " SU 5      $ )Nz^[a-z]+$z^[a-z]+_[A-Z0-9].*$)rematch)locales    r   is_valid_localer   *   s$    88K(TBHH5KV,TTr   c                   <    \ rS rSrS rS rS rS r\S 5       r	Sr
g)	TranslatableFile.   c                 (    X l         Xl        X0l        g N)filedirpath
locale_dir)selfr%   	file_namer&   s       r   __init__TranslatableFile.__init__0   s    	$r   c                     SU R                   R                  < S[        R                  R	                  U R
                  U R                  /5      < S3$ )N<z: >)	__class____name__ossepjoinr%   r$   r'   s    r   __repr__TranslatableFile.__repr__5   s6    NN##FFKKtyy12
 	
r   c                 4    U R                   UR                   :H  $ r#   pathr'   others     r   __eq__TranslatableFile.__eq__;   s    yyEJJ&&r   c                 4    U R                   UR                   :  $ r#   r7   r9   s     r   __lt__TranslatableFile.__lt__>   s    yy5::%%r   c                 j    [         R                  R                  U R                  U R                  5      $ r#   )r0   r8   r2   r%   r$   r3   s    r   r8   TranslatableFile.pathA   s    ww||DLL$))44r   )r%   r$   r&   N)r/   
__module____qualname____firstlineno__r)   r4   r;   r>   propertyr8   __static_attributes__ r   r   r    r    .   s*    %

'& 5 5r   r    c                   `    \ rS rSrSrS r\S 5       r\S 5       r\S 5       r	S r
S rS	 rS
rg)	BuildFileF   zF
Represent the state of a translatable file during the build process.
c                 (    Xl         X l        X0l        g r#   commanddomaintranslatable)r'   rM   rN   rO   s       r   r)   BuildFile.__init__K   s    (r   c                     U R                   S:X  a;  [        R                  R                  U R                  R
                  5      S   nUS:g  $ g)Ndjango   .pyF)rN   r0   r8   splitextrO   r$   )r'   file_exts     r   is_templatizedBuildFile.is_templatizedP   sA    ;;("ww''(9(9(>(>?BHu$$r   c                 .    U R                   R                  $ r#   )rO   r8   r3   s    r   r8   BuildFile.pathW   s      %%%r   c                     U R                   (       d  U R                  $ U R                  R                   S3n[        R                  R                  U R                  R                  U5      $ )z}
Path to a file which is being fed into GNU gettext pipeline. This may
be either a translatable or its preprocessed version.
rT   )rW   r8   rO   r$   r0   r2   r%   )r'   filenames     r   	work_pathBuildFile.work_path[   sQ     ""99'',,-S1ww||D--55x@@r   c                 r   U R                   (       d  g[        U R                  SS9 nUR                  5       nSSS5        U R                  S:X  a  [        WU R                  SS S9n[        U R                  SSS9 nUR                  W5        SSS5        g! , (       d  f       Ne= f! , (       d  f       g= f)zb
Preprocess (if necessary) a translatable file before passing it to
xgettext GNU gettext utility.
Nutf-8encodingrR      )originw)rW   openr8   readrN   r   r]   write)r'   fpsrc_datacontents       r   
preprocessBuildFile.preprocessf   s    
 ""$))g."wwyH / ;;(" $))AB-@G$..#8BHHW 98 /. 98s   B<B(
B%(
B6c                 J  ^^ U R                   (       d  U$ [        R                  S:X  a  U R                  mU R                  mOU R                  SS mU R                  SS m[
        R                  " S[
        R                  " T5      -   S-   UU4S jU[
        R                  S9$ )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.
ntrc   Nz	^(#: .*)()c                 .   > U S   R                  TT5      $ )Nr   )replace)r   new_pathold_paths    r   <lambda>0BuildFile.postprocess_messages.<locals>.<lambda>   s    %(**8X>r   )flags)	rW   r0   namer]   r8   r   subescape	MULTILINE)r'   msgsrs   rt   s     @@r   postprocess_messagesBuildFile.postprocess_messagesw   s     ""K 77d?~~HyyH~~ab)Hyy}Hvv299X..5>,,	
 	
r   c                     U R                   (       aP  [        R                  R                  U R                  5      (       a!  [        R
                  " U R                  5        ggg)z=
Remove a preprocessed copy of a translatable file (if any).
N)rW   r0   r8   existsr]   unlinkr3   s    r   cleanupBuildFile.cleanup   s@      ww~~dnn--		$..) .	 r   rL   N)r/   rB   rC   rD   __doc__r)   r   rW   r8   r]   rl   r}   r   rF   rG   r   r   rI   rI   F   sY    )
   & & A A"
4	*r   rI   c                     U R                  5       nU(       a  US   (       a  UR                  S5        SR                  U5      $ )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appendr2   )raw_contents
lines_lists     r   normalize_eolsr      s8     ((*Jjn"99Z  r   c                    UR                  5       n[        R                  R                  U 5      (       a  [	        [
        U5      nOX/ nSu  pEU HL  nU(       d!  U(       d  SU;   a  SnUR                  SS5      nU(       d	  U(       d  SnUR                  U5        MN     SR                  U5      n[        U SSSS9 nUR                  U5        S	S	S	5        g	! , (       d  f       g	= f)
zP
Write the `potfile` with the `msgs` contents, making sure its format is
valid.
)FFzcharset=CHARSETTzcharset=UTF-8r   ar`   )rb   newlineN)r   r0   r8   r   r   lenrr   r   r2   rf   rh   )potfiler|   	pot_lineslinesfoundheader_readlineri   s           r   write_pot_filer      s    
 !I	ww~~g#y))D$, E<<(9?KD"LL  99UD 
gsWd	;r
 
<	;	;s   ;C
C$c                       \ rS rSrSr\r\r/ r	/ SQr
S/rS/rSS/rS rS	 r\S
 5       r\S 5       rS rS rS rS rS rS rS rSrg)Command   aH  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           
         UR                  SS/ SSS9  UR                  SS/ SSS9  UR                  S	S
SSS9  UR                  SSSSS9  UR                  SSSSSS9  UR                  SSSSS9  UR                  SSSS/ SSS 9  UR                  S!S"S#S$S%9  UR                  S&SS'S9  UR                  S(SS)S9  UR                  S*S+S,S-S.S/9  UR                  S0SS1S9  UR                  S2SS3S9  g )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-drR   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_argumentsCommand.add_arguments   s   6 	 		
 	S 	 	
 	G	 	 	
 	F	 	 	
 	0 	 	
 	5	 	 	
 	"1 	 		
 	! . 	 	
 	E 	 	

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

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

 	O 	 	
r   c                    US   nUS   nUS   U l         US   U l        US   nUS   nUS   U l        US   nUS	   (       a  U/ S
Q-  n[        [	        U5      5      U l        US   (       a`  U R                  S S  S/-   U l        U R                  S S  S/-   U l        U R                  S S  S/-   U l        U R                  S S  S/-   U l	        US   (       a`  U R                  S S  S/-   U l        U R                  S S  S/-   U l        U R                  S S  S/-   U l        U R                  S S  S/-   U l	        US   (       ah  SUS   -  nU R                  S S  U/-   U l        U R                  S S  U/-   U l        U R                  S S  U/-   U l        U R                  S S  U/-   U l	        US   U l
        US   U l        U R                   S;  a  [        S5      eU R                   S:X  a  U=(       d    S/n	OU=(       d    / SQn	[        U	5      U l        U(       d  U(       d  U(       a  U R                   cS  [        S[        R                   R#                  [$        R&                  S   5      < S[$        R&                  S   < S35      eU R                  S:  a;  U R(                  R+                  S[-        [        U R                  5      S5      -  5        SU l        / U l        S U l        [        R                   R5                  [        R                   R7                  S S5      5      (       a{  [        R                   R9                  [        R                   R7                  S S5      5      /U l        U R0                  S   U l        U R
                  R;                  S!5        S"U l        GO$U R<                  (       ab  [>        R@                   HN  n
[        R                   R9                  U
5      nXR0                  ;  d  M3  U R0                  R;                  U5        MP     [        R                   R5                  S5      (       aI  [        R                   R9                  S5      nXR0                  ;  a  U R0                  R;                  U5        U R0                  (       a3  U R0                  S   U l        [        RB                  " U R2                  S"S#9  [D        RF                  " S$5      n[I        [        R                   R4                  [J        RJ                  " S%U R2                  -  5      5      n[M        [        R                   R"                  U5       Vs/ sH  nURO                  U5      (       d  M  UPM     nnU(       a  UnO%U=(       d    Un[	        U5      RQ                  U5      nU(       a  [S        S&S'S(5        [S        S)5         U RU                  5       nU GH*  n[W        U5      (       d  [D        RN                  " S*U5      nU(       aJ  URY                  5       nUS+   R[                  5       nUS,   S S- R]                  5       US,   S-S  -   nU S.U 3nOUR[                  5       n[W        U5      (       a%  U R(                  R+                  S/U< S0U< S135        OU R(                  R+                  S2U-  5        M  U R                  S:  a  U R(                  R+                  S3U-  5        U H  nU R_                  UU5        M     GM-     U R                  (       d  U Ra                  5         g g s  snf ! U R                  (       d  U Ra                  5         f f = f)4Nr   excluderN   	verbosityallr   symlinksr   r   )CVSz.*z*~z*.pycno_wrapr   no_locationr   add_locationz--add-location=%sno_obsoletekeep_pot)rR   djangojszDcurrently makemessages only supports domains 'django' and 'djangojs'r   js)htmltxtpyzType 'r   z help rS   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/*msguniqmsgmerge	msgattribxgettextzB^(?P<language>[a-zA-Z]+)(?P<separator>[^a-zA-Z])(?P<territory>.+)$language	territoryrc   _zinvalid locale z, did you mean r   zinvalid locale %szprocessing locale %s)1rN   r   r   listsetr   msgmerge_optionsmsguniq_optionsmsgattrib_optionsxgettext_optionsr   r   r
   r   r   r0   r8   basenamesysargvstdoutrh   r   invoked_for_djangolocale_pathsdefault_locale_pathisdirr2   abspathr   settings_availabler   LOCALE_PATHSmakedirsr   compilefilterglobmapr   
differencer   build_potfilesr   	groupdictlowerupperwrite_po_fileremove_potfiles)r'   argsoptionsr   r   process_allr   r   arg_add_locationextsr8   locale_pathlooks_like_localelocale_dirs	lang_codeall_localeslocalespotfilesr   locale_partsr   r   proposed_localer   s                           r   handleCommand.handle=  se   ")$h' -en\*

+!"3401;;O#C$89 9$($9$9!$<}$LD!#'#7#7#:k]#JD %)%;%;A%>+%ND"$($9$9!$<}$LD!=!$($9$9!$<?P$PD!#'#7#7#:o=N#ND %)%;%;A%>/AR%RD"$($9$9!$<?P$PD!>"2W^5LL$($9$9!$<@P?Q$QD!#'#7#7#:>N=O#OD %)%;%;A%>BRAS%SD"$($9$9!$<@P?Q$QD!"=1
+;;44*  ;;*$'$D6!6D+D1w{t{{?R77##CHHQK0#((1+? 
 >>AKK9T__ 5u=>
 #(#' 77==fh788!#fh1O!P QD'+'8'8';D$  ''(IJ&*D#&&$11D"$''//$"7K"*;*;;))00= 2
 ww}}X&& ggooh7&7&77%%,,[9  +/+<+<Q+?(D44tD JJ{3GGMM499Vd.F.F%FG

 !!1!1;?
?	 &&y1 ? 	 
 !G+G'l--g6G9j+>z"1	'**,H "&v.. HH. 	E ','8#/
#;#A#A#C(5bq9??A*;7;< " .6Ja	{*C +1,,. '77)) !' / ))*=*FG>>A%KK%%&<v&EF'G&&w7  (S "X ==$$& !E
D ==$$& !s   \ %\ <E\% %$]	c                     [        SS/[        S9u  pn[        R                  " SU5      nU(       a   [	        S UR                  5        5       5      $ [        S5      e)Nr   z	--version)stdout_encodingz(\d+)\.(\d+)\.?(\d+)?c              3   >   #    U H  oc  M  [        U5      v   M     g 7fr#   )int).0ds     r   	<genexpr>*Command.gettext_version.<locals>.<genexpr>  s     EAQs   z/Unable to get gettext version. Is it installed?)r   r   r   searchtuplegroupsr
   )r'   outerrstatusms        r   gettext_versionCommand.gettext_version  sW    
 )%3
& II.4EEEEPQQr   c                      [         R                    g! [         a.    U R                  S:  a  U R                  R                  S5         gf = f)NrS   z$Running without configured settings.FT)r   r   r   r   stderrrh   r3   s    r   r   Command.settings_available  sH    	!!
 	 $ 	~~!!!"HI	s    5A
Ac                    U R                  S5      nU R                  5         U R                  U5        / nU R                   GH  n[        R
                  R                  USU R                  -  5      n[        R
                  R                  U5      (       d  MW  S/U R                  QUPn[        U5      u  pgnU(       aC  U[        :w  a  [        SU-  5      eU R                  S:  a  U R                  R                  U5        [!        U5      n[#        USSS9 n	U	R                  U5        S	S	S	5        UR%                  U5        GM     U$ ! , (       d  f       N&= f)
z,
Build pot files and apply msguniq to them.
.%s.potr   z(errors happened while running msguniq
%sr   re   r`   ra   N)
find_filesr   process_filesr   r0   r8   r2   rN   r   r   r   	STATUS_OKr
   r   r   rh   r   rf   r   )
r'   	file_listr   r8   r   r   r|   errorsr  ri   s
             r   r   Command.build_potfiles  s    OOC(	9%%%Dggll4DKK)?@G77>>'**> 4 4>g>D#0#6 D&Y&&CfL  ^^a'KK%%f-!$'DgsW5 6OOG$! &"  65s   E		
E	c                     U R                    Hl  n[        R                  R                  USU R                  -  5      n[        R                  R                  U5      (       d  MV  [        R                  " U5        Mn     g )Nr  )r   r0   r8   r2   rN   r   r   )r'   r8   pot_paths      r   r   Command.remove_potfiles  sN    %%Dww||D(T[[*@AHww~~h''		(# &r   c           
      >   / n/ nU R                   (       aU  [        R                  [        R                  4 Vs/ sH+  nU(       d  M  [        R
                  R                  U5      PM-     nn[        R                  " USU R                  S9 GH  u  pVnUSS  GHy  n[        [        R
                  R                  [        R
                  R                  XX5      5      U R                  5      (       dA  [        R
                  R                  [        R
                  R                  U5      U5      U;   aC  UR                  U5        U R                  S:  a   U R                  R!                  SU-  5        M  M  US:X  d  M  UR                  U5        [        R
                  R                  [        R
                  R                  U5      U5      n	XR"                  ;   a  U R"                  R                  U	5        U R"                  R%                  SU	5        GM|     U GHn  n
[        R
                  R                  [        R
                  R                  XZ5      5      n[        R
                  R'                  U
5      S   nXR(                  ;  d  [        XR                  5      (       a7  U R                  S:  a%  U R                  R!                  SU
< S	U< 35        M  M  Sn	U R"                   HW  n[        R
                  R                  U5      R+                  [        R
                  R-                  U5      5      (       d  MU  Un	  O   U	=(       d    U R.                  =(       d    [0        n	UR3                  U R5                  XZU	5      5        GMq     GM     [7        U5      $ s  snf )
z`
Get all files in the given root. Also check that there is a matching
locale dir for each file.
T)topdownfollowlinksNrS   zignoring directory %sr   r   zignoring file  in )r   r   
MEDIA_ROOTSTATIC_ROOTr0   r8   normpathwalkr   r   r2   r   r   remover   r   rh   r   insertrU   r   
startswithdirnamer   NO_LOCALE_DIRr   translatable_file_classsorted)r'   root	all_filesignored_rootspr%   dirnames	filenamesr)  r&   r\   	file_pathrV   r8   s                 r   r  Command.find_files  s   
 	"" #--x/C/CDDA $  #D  
 -/GG$DMM-
(Gy $A;#((g)GH,,  ww||BGGOOG$<gF-WOOG,~~)))*AG*KL *(OOG,!#bggoog.F!PJ!%6%66))00<%%,,Q
;! '" &GG,,RWW\\'-LM	77++H5a8??2o337 7 ~~)))8@'J *
 "&J $ 1 177??73>>rwwt?TUU)-J! !2 ",!Xt/G/G!X=J$$44W
S# &)-
P i  [s   
N#Nc                     0 nU H0  nUR                  UR                  / 5      nUR                  U5        M2     UR                  5        H  u  pVU R	                  XV5        M     g)z]
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_groupsrO   
file_groupr&   filess          r   r  Command.process_filesI  s_    
 %L$//0G0GLJl+ & "-!2!2!4J##J6 "5r   c                    / nU H  nU R                   S:  a7  U R                  R                  SUR                  < SUR                  < 35        U R
                  S;  a  M\  U R                  X R
                  U5      n UR                  5         UR                  U5        M     U R
                  S	:X  a  S
SU R
                  SSSSSSS/
nO*U R
                  S:X  a  S
SU R
                  SSSSSSSSS/nOgU Vs/ sH  oR                  PM     n	n[        SS9 n
U
R                  SR                  U	5      5        U
R                  5         UR!                  SU
R"                  /5        UR!                  U R$                  5        ['        U5      u  pnSSS5        W(       ap  W[(        :w  a;  U H  nUR                  5         M     [+        SSR                  U	5      < SU< 35      eU R                   S:  a  U R                  R                  U5        W(       a  U[,        L aS  U H  nUR                  5         M     [.        R0                  R3                  US   R0                  5      n[+        SU-  5      eU H  nUR5                  U5      nM     [.        R0                  R                  USU R
                  -  5      n[7        X5        U H  nUR                  5         M     g! [         aH  nU R                  R                  SUR                  < SUR                  < SU< S35         SnAGM$  SnAf[         a    U H  nUR                  5         M     e f = fs  snf ! , (       d  f       GN= f)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.
rS   zprocessing file r!  r   rR   z!UnicodeDecodeError: skipped file z
 (reason: rp   Nr   r   r   z--language=JavaScriptz--keyword=gettext_noopz--keyword=gettext_lazyz--keyword=ngettext_lazy:1,2z--keyword=pgettext:1c,2z--keyword=npgettext:1c,2,3z
--output=-rR   z--language=Pythonz--keyword=pgettext_lazy:1c,2z--keyword=npgettext_lazy:1c,2,3z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   rh   r$   r%   rN   build_file_classrl   UnicodeDecodeErrorBaseExceptionr   r   r]   r   r2   flushextendrx   r   r   r  r
   r*  r0   r8   r$  r}   r   )r'   r&   r;  build_filesrO   
build_fileer   bfinput_filesinput_files_listr|   r  r  r3  r   s                   r   r8  Command.process_locale_dirU  s    !L~~!!!#((,*>*>@ {{"88..t[[,OJ%%'  z*5 "8 ;;*$'((-),D [[H$#((-),.1D .9:k||k:T*.>""499[#9:""$KK)9)>)>?@KK--.#0#6 D& + ""-J&&( #."yy-v7  !#!!&)]*"-J&&( #.GG,,[^-@-@A	":<EF 
 *
!66t< *ggll:x$++/EFG7)%J  &g & 	!! %))$,,	   "-J&&( #.	L ;**s+   >K8MA7M
M&<L))(M
M(c                    [         R                  R                  [         R                  R                  U5      US5      n[         R                  " USS9  [         R                  R                  USU R
                  -  5      n[         R                  R                  U5      (       a  S/U R                  QUPUPn[        U5      u  pgnU(       aC  U[        :w  a  [        SU-  5      eU R                  S:  a  U R                  R                  U5        [        U5      R                  SS	9n	OF[!        USS	9 n
U
R#                  5       n	S
S
S
5        U R$                  (       d  U R'                  W	U5      n	[)        W	5      n	U	R+                  SU R
                  -  S5      n	[!        USSS	9 n
U
R                  U	5        S
S
S
5        U R,                  (       ap  S/U R.                  QSPUPUPn[        U5      u  pnU(       aE  U[        :w  a  [        SU-  5      eU R                  S:  a  U R                  R                  U5        g
g
g
g
! , (       d  f       GN= f! , (       d  f       N= f)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`   ra   Nz2#. #-#-#-#-#  %s.pot (PACKAGE VERSION)  #-#-#-#-#
r   re   r   z-oz*errors happened while running msgattrib
%s)r0   r8   r2   r)  r   rN   r   r   r   r  r
   r   r   rh   r   	read_textrf   rg   r   copy_plural_formsr   rr   r   r   )r'   r   r   basedirpofiler   r   r  r  r|   ri   s              r   r   Command.write_po_file  s    '',,rwww7O
Gd+gw'<=77>>&!!H!6!6HHHD -d 3AvY&&DvM  ^^a'KK%%f-<))7);Dg0Bwwy 1**--dF;d#||ADKKOQS
 &#0BHHTN 1 O$"8"8O$OOOD#0#6 D&Y&&EN  ^^a'KK%%f- (   10 10s   3I $I 
I
I c           
         [         R                  R                  [         R                  R                  [         R                  R	                  [
        R                  5      5      5      nU R                  S:X  a  SnOSnU GH,  n[         R                  R                  USSUSSU-  5      n[         R                  R                  U5      (       d  MQ  [        USS	9 n[        R                  UR                  5       5      nS
S
S
5        W(       d  M  US   n	U R                  S:  a  U R                  R                  SU	-  5        / n
SnUR!                  5        H@  nU(       d%  U(       a  [        R                  U5      (       a  U	nSnU
R#                  U5        MB     SR                  U
5      n  U$    U$ ! , (       d  f       N= f)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.
r   r>  )rR   r   r   rM  rN  r`   ra   NvaluerS   zcopying plural forms: %sFTr   )r0   r8   r$  r2   r)  rR   __file__rN   r   rf   plural_forms_rer  rg   r   r   rh   r   r   )r'   r|   r   
django_dirdomainsrN   	django_pori   r  plural_form_liner   r   r   s                r   rP  Command.copy_plural_forms  sX    WW%%bggll277??6??3S&TU
;;*$,G!GFFHfmWvEUI ww~~i(()g6"'..rwwy9A 71'(z$~~)))*DGW*WXE!E $ 1$do6L6LT6R6R#3D$(ET*	 !2
  99U+D) (  76s   $F22
G 	)r   rN   r   r   r   r   r   r   r   r   r   r   r   r   N)r/   rB   rC   rD   r   r    r+  rI   r@  requires_system_checksr   r   r   r   r   r   r   r  r   r   r   r  r  r8  r   rP  rF   rG   r   r   r   r      s    	' 	 / H()O()+-IJa
FY'v R R  6$5!n
7g!R+.Zr   r   )0r   r0   r   r   	functoolsr   	itertoolsr   pathlibr   rR   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.regex_helperr   django.utils.textr   django.utils.translationr   r{   DOTALLrW  r  objectr*  r   r   r    rI   r   r   r   rG   r   r   <module>rm     s     	 	 
 $      7 5 A  : 3 6 + /"+R\\BII-E 	U 5 5 5.T* T*n!6C	k C	r   