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
5
.gitignore
vendored
5
.gitignore
vendored
@ -67,4 +67,7 @@ secret_key.txt
|
|||||||
htmlcov/
|
htmlcov/
|
||||||
|
|
||||||
# Development files
|
# Development files
|
||||||
dev/
|
dev/
|
||||||
|
|
||||||
|
# Locale stats file
|
||||||
|
locale_stats.json
|
||||||
|
@ -3,6 +3,7 @@ This script calculates translation coverage for various languages
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
|
|
||||||
def calculate_coverage(filename):
|
def calculate_coverage(filename):
|
||||||
@ -36,8 +37,10 @@ if __name__ == '__main__':
|
|||||||
|
|
||||||
MY_DIR = os.path.dirname(os.path.realpath(__file__))
|
MY_DIR = os.path.dirname(os.path.realpath(__file__))
|
||||||
LC_DIR = os.path.abspath(os.path.join(MY_DIR, '..', 'locale'))
|
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 = {}
|
||||||
|
locales_perc = {}
|
||||||
|
|
||||||
print("InvenTree translation coverage:")
|
print("InvenTree translation coverage:")
|
||||||
|
|
||||||
@ -64,5 +67,10 @@ if __name__ == '__main__':
|
|||||||
percentage = 0
|
percentage = 0
|
||||||
|
|
||||||
print(f"| {locale.ljust(4, ' ')} : {str(percentage).rjust(4, ' ')}% |")
|
print(f"| {locale.ljust(4, ' ')} : {str(percentage).rjust(4, ' ')}% |")
|
||||||
|
locales_perc[locale] = percentage
|
||||||
|
|
||||||
print("-" * 16)
|
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