Add a backup of po files
This commit is contained in:
parent
280a904799
commit
b6ef8ea32c
|
|
@ -6,6 +6,7 @@ Portable script to update po files on most platforms
|
||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
from sys import stderr, exit
|
from sys import stderr, exit
|
||||||
|
import shutil
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
import polib
|
import polib
|
||||||
from polib import POFile
|
from polib import POFile
|
||||||
|
|
@ -34,6 +35,9 @@ def main():
|
||||||
return 1
|
return 1
|
||||||
|
|
||||||
for po_file in PO_FILE_LIST:
|
for po_file in PO_FILE_LIST:
|
||||||
|
# Start by creating a back-up of the .po file
|
||||||
|
po_file_bak = po_file.with_suffix(".bak")
|
||||||
|
shutil.copy(PO_DIR / po_file, PO_DIR / po_file_bak)
|
||||||
po = polib.pofile(po_file)
|
po = polib.pofile(po_file)
|
||||||
po.merge(POT_REFERENCE)
|
po.merge(POT_REFERENCE)
|
||||||
po.save(po_file)
|
po.save(po_file)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue