mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
script to save the locale stats
This commit is contained in:
parent
3ecb1e6577
commit
d6672372a5
3
.gitignore
vendored
3
.gitignore
vendored
@ -68,3 +68,6 @@ htmlcov/
|
||||
|
||||
# Development files
|
||||
dev/
|
||||
|
||||
# Locale stats file
|
||||
locale_stats.json
|
||||
|
@ -3,6 +3,7 @@ This script calculates translation coverage for various languages
|
||||
"""
|
||||
|
||||
import os
|
||||
import json
|
||||
|
||||
|
||||
def calculate_coverage(filename):
|
||||
@ -36,8 +37,10 @@ if __name__ == '__main__':
|
||||
|
||||
MY_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||
LC_DIR = os.path.abspath(os.path.join(MY_DIR, '..', 'locale'))
|
||||
STAT_FILE = os.path.abspath(os.path.join(MY_DIR, '..', 'InvenTree/locale_stats.json'))
|
||||
|
||||
locales = {}
|
||||
locales_perc = {}
|
||||
|
||||
print("InvenTree translation coverage:")
|
||||
|
||||
@ -64,5 +67,10 @@ if __name__ == '__main__':
|
||||
percentage = 0
|
||||
|
||||
print(f"| {locale.ljust(4, ' ')} : {str(percentage).rjust(4, ' ')}% |")
|
||||
locales_perc[locale] = percentage
|
||||
|
||||
print("-" * 16)
|
||||
|
||||
# write locale stats
|
||||
with open(STAT_FILE, 'w') as target:
|
||||
json.dump(locales_perc, target)
|
||||
|
Loading…
Reference in New Issue
Block a user