Skip to content

Instantly share code, notes, and snippets.

@flodolo
Last active August 29, 2015 14:16
Show Gist options
  • Save flodolo/d36d1512c60fa9702e33 to your computer and use it in GitHub Desktop.
Save flodolo/d36d1512c60fa9702e33 to your computer and use it in GitHub Desktop.
po stats
#! /usr/bin/env python
import polib
from BeautifulSoup import BeautifulSoup
def stripAllTags(html):
return ''.join(BeautifulSoup(html).findAll(text = True))
string_count = 0
word_count = 0
po = polib.pofile('django.po')
valid_entries = [e for e in po if not e.obsolete]
for entry in valid_entries:
string_count += 1
word_count += len(entry.msgstr.split())
print "Number of strings: %s" % (string_count)
print "Number of words: %s" % (word_count)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment