weblate/scripts/locales-grep
Michal Čihař 34e6c7c4b6 Misc: Remove encoding pragma
It is not needed in Python 3.
2020-03-12 09:44:36 +01:00

17 lines
475 B
Python
Executable file

#!/usr/bin/env python3
import sys
from glob import glob
from translate.storage.pypo import pofile
for filename in glob("weblate/locale/*/LC_MESSAGES/*.po"):
print(filename)
storage = pofile.parsefile(filename)
for unit in storage.units:
if not unit.istranslatable():
continue
if sys.argv[1] in unit.source:
print(unit.source)
if unit.istranslated() and sys.argv[1] in unit.target:
print(unit.target)