Files
tdesktop/Telegram/Resources/langs/refresh.py
allhaileris afb81b8278
Some checks failed
Docker. / Ubuntu (push) Has been cancelled
User-agent updater. / User-agent (push) Failing after 15s
Lock Threads / lock (push) Failing after 10s
Waiting for answer. / waiting-for-answer (push) Failing after 22s
Close stale issues and PRs / stale (push) Successful in 13s
Needs user action. / needs-user-action (push) Failing after 8s
Can't reproduce. / cant-reproduce (push) Failing after 8s
init
2026-02-16 15:50:16 +03:00

31 lines
758 B
Python

import os, sys, requests, re
from os.path import expanduser
filename = ''
for arg in sys.argv:
if re.match(r'.*\.strings$', arg):
filename = expanduser(arg)
result = ''
if not os.path.isfile(filename):
print("File not found.")
sys.exit(1)
with open(filename) as f:
for line in f:
if re.match(r'\s*\/\* new from [a-zA-Z0-9\.]+ \*\/\s*', line):
continue
if re.match(r'\"lng_[a-z_]+\#(zero|two|few|many)\".+', line):
continue
result = result + line
remove = 0
while (len(result) > remove + 1) and (result[len(result) - remove - 1] == '\n') and (result[len(result) - remove - 2] == '\n'):
remove = remove + 1
result = result[:len(result) - remove]
with open('lang.strings', 'w') as out:
out.write(result)
sys.exit()