Last active
August 29, 2015 14:15
-
-
Save nijel/6afc9f4ad5cb19a78403 to your computer and use it in GitHub Desktop.
Count units in a translation file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from translate.storage import factory | |
import sys | |
f = factory.getobject(sys.argv[1]) | |
print( | |
'File {0} has {1} units'.format( | |
sys.argv[1], | |
len(f.units) | |
) | |
) | |
print( | |
'File {0} has {1} translatable units'.format( | |
sys.argv[1], | |
len([unit for unit in f.units if unit.istranslatable()]) | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment