You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
	
	
		
			30 lines
		
	
	
		
			684 B
		
	
	
	
		
			Python
		
	
			
		
		
	
	
			30 lines
		
	
	
		
			684 B
		
	
	
	
		
			Python
		
	
#!/bin/python3
 | 
						|
 | 
						|
 | 
						|
# usage : ./tools/compareLocalizedStrings.py en de
 | 
						|
 | 
						|
import re
 | 
						|
from os import path, listdir
 | 
						|
from glob import glob
 | 
						|
import json
 | 
						|
import sys
 | 
						|
 | 
						|
LOCALES_FOLDER = './_locales'
 | 
						|
 | 
						|
EN_FILE = LOCALES_FOLDER + '/en/messages.json'
 | 
						|
 | 
						|
LOCALIZED_KEYS_FILE = './ts/types/LocalizerKeys.ts'
 | 
						|
 | 
						|
stringToWrite = "export type LocalizerKeys =\n  | "
 | 
						|
 | 
						|
with open(EN_FILE,'r') as jsonFile:
 | 
						|
    data = json.load(jsonFile)
 | 
						|
    keys = data.keys()
 | 
						|
 | 
						|
    stringToWrite += json.dumps(keys, sort_keys=True).replace(',', '\n  |').replace('"', '\'')[1:-1]
 | 
						|
    # print(stringToWrite)
 | 
						|
    with open(LOCALIZED_KEYS_FILE, "w") as typeFile:
 | 
						|
        typeFile.write(stringToWrite)
 | 
						|
 | 
						|
print('Updated LocalizerKeys.ts')
 |