File tree Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Expand file tree Collapse file tree 2 files changed +15
-9
lines changed Original file line number Diff line number Diff line change @@ -55,7 +55,7 @@ main | <a href="metadata.html" target="_self">meta</a>
5555<p >* the number in parentheses shows change in the last 30 days, included in the total completion</p >
5656<p >
5757Currently being translated into {{ completion_progress|length }} languages.
58- The documentation has a total word count of {{ '{:,}'.format(word_count ) }}.
58+ The documentation has a total string count of {{ '{:,}'.format(counts[ 0] ) }} ({{ '{:,}'.format(counts[ 1] ) }} words) .
5959For more information about translations, see the <a href =" https://devguide.python.org/documentation/translating/" >Python Developer’s Guide</a >.
6060</p >
6161<hr >
Original file line number Diff line number Diff line change 1- import os
1+ from pathlib import Path
2+
23from polib import pofile
34
45
5- def _count_words (pot ) -> int :
6+ def _count (pot ) -> tuple [ int , int ] :
67 pot = pofile (pot )
8+ string_count = 0
79 word_count = 0
810 for entry in pot :
11+ string_count += 1
912 word_count += len (entry .msgid .split ())
10- return word_count
13+ return string_count , word_count
1114
1215
13- def get_word_count (dir ) -> int :
16+ def get_counts (dir : Path ) -> tuple [int , int ]:
17+ total_string_count = 0
1418 total_word_count = 0
15- for root , dirs , files in os .walk (dir ):
19+ for root , dirs , files in dir .walk ():
1620 for file in files :
1721 if file .endswith ('.pot' ):
18- pot = os .path .join (root , file )
19- total_word_count += _count_words (pot )
20- return total_word_count
22+ pot = root .joinpath (root , file )
23+ strings , words = _count (pot )
24+ total_string_count += strings
25+ total_word_count += words
26+ return total_string_count , total_word_count
You can’t perform that action at this time.
0 commit comments