Created
January 4, 2017 16:42
-
-
Save ecarreras/1d10031fa3e0b73ef891358e57a813dc to your computer and use it in GitHub Desktop.
This file contains hidden or 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 babel.messages import catalog, pofile | |
SPLITS = 10 | |
catalogs = [catalog.Catalog(locale='es_ES') for _ in range(0, SPLITS)] | |
with open('locales/es_ES/LC_MESSAGES/messages.po', 'r') as f: | |
po = pofile.read_po(f) | |
untranslated = [s.id for s in po if not s.string] | |
for idx, string in enumerate(untranslated): | |
c_idx = idx % SPLITS | |
c = catalogs[c_idx] | |
c.add(string) | |
for idx, c in enumerate(catalogs): | |
with open('locales/es_ES/LC_MESSAGES/messages.{}.po'.format(idx), 'w') as f: | |
pofile.write_po(f, c) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment