Changeset View
Changeset View
Standalone View
Standalone View
contrib/devtools/update-translations.py
Show All 31 Lines | |||||
# Minimum number of messages for translation to be considered at all | # Minimum number of messages for translation to be considered at all | ||||
MIN_NUM_MESSAGES = 10 | MIN_NUM_MESSAGES = 10 | ||||
def check_at_repository_root(): | def check_at_repository_root(): | ||||
if not os.path.exists('.git'): | if not os.path.exists('.git'): | ||||
print('No .git directory found') | print('No .git directory found') | ||||
print('Execute this script at the root of the repository', file=sys.stderr) | print('Execute this script at the root of the repository', file=sys.stderr) | ||||
exit(1) | sys.exit(1) | ||||
def fetch_all_translations(): | def fetch_all_translations(): | ||||
if subprocess.call([TX, 'pull', '-f', '-a']): | if subprocess.call([TX, 'pull', '-f', '-a']): | ||||
print('Error while fetching translations', file=sys.stderr) | print('Error while fetching translations', file=sys.stderr) | ||||
exit(1) | sys.exit(1) | ||||
def find_format_specifiers(s): | def find_format_specifiers(s): | ||||
'''Find all format specifiers in a string.''' | '''Find all format specifiers in a string.''' | ||||
pos = 0 | pos = 0 | ||||
specifiers = [] | specifiers = [] | ||||
while True: | while True: | ||||
percent = s.find('%', pos) | percent = s.find('%', pos) | ||||
▲ Show 20 Lines • Show All 175 Lines • Show Last 20 Lines |