Add script to clean up after Crowdin
Crowdin does not delete files from translations when the main language has a deleted file. This script will do that job for them.
This commit is contained in:
parent
af2a26e8d0
commit
f89b684613
1 changed files with 25 additions and 0 deletions
25
clean_translations.py
Normal file
25
clean_translations.py
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
files_in_main = []
|
||||||
|
files_in_main_include = []
|
||||||
|
|
||||||
|
|
||||||
|
for i in os.listdir("_pages/en_US/"):
|
||||||
|
files_in_main.append(i)
|
||||||
|
|
||||||
|
for i in os.listdir("_pages/en_US/include"):
|
||||||
|
files_in_main_include.append(i)
|
||||||
|
|
||||||
|
for i in os.listdir("_pages/"):
|
||||||
|
if i == "en_US":
|
||||||
|
continue
|
||||||
|
for j in os.listdir(f"_pages/{i}"):
|
||||||
|
if j == "include":
|
||||||
|
for k in os.listdir(f"_pages/{i}/include"):
|
||||||
|
if k not in files_in_main_include:
|
||||||
|
print(f"Deleting _pages/{i}/include/{k}")
|
||||||
|
os.remove(f"_pages/{i}/include/{k}")
|
||||||
|
elif j not in files_in_main:
|
||||||
|
print(f"Deleting _pages/{i}/{j}")
|
||||||
|
os.remove(f"_pages/{i}/{j}")
|
Loading…
Reference in a new issue