mirror of
https://github.com/arsenetar/dupeguru.git
synced 2026-01-22 14:41:39 +00:00
Added the --normpo build option
This build command normalizes all PO so that I stop getting spurious diffs whenever I pull from Transifex.
This commit is contained in:
@@ -77,6 +77,24 @@ def merge_po_and_preserve(source, dest):
|
||||
destpo.append(entry)
|
||||
destpo.save()
|
||||
|
||||
def normalize_all_pos(base_folder):
|
||||
"""Normalize the format of .po files in base_folder.
|
||||
|
||||
When getting POs from external sources, such as Transifex, we end up with spurious diffs because
|
||||
of a difference in the way line wrapping is handled. It wouldn't be a big deal if it happened
|
||||
once, but these spurious diffs keep overwriting each other, and it's annoying.
|
||||
|
||||
Our PO files will keep polib's format. Call this function to ensure that freshly pulled POs
|
||||
are of the right format before committing them.
|
||||
"""
|
||||
langs = get_langs(base_folder)
|
||||
for lang in langs:
|
||||
pofolder = op.join(base_folder, lang, LC_MESSAGES)
|
||||
pofiles = files_with_ext(pofolder, '.po')
|
||||
for pofile in pofiles:
|
||||
p = polib.pofile(pofile)
|
||||
p.save()
|
||||
|
||||
#--- Cocoa
|
||||
def all_lproj_paths(folder):
|
||||
return files_with_ext(folder, '.lproj')
|
||||
|
||||
Reference in New Issue
Block a user