mirror of
https://github.com/acemod/ACE3.git
synced 2024-08-30 18:23:18 +00:00
Also search for missing stringtable entries
This commit is contained in:
parent
6773119f09
commit
5555eb195a
@ -9,7 +9,7 @@
|
|||||||
<Czech>Nastavení Pozorovatele</Czech>
|
<Czech>Nastavení Pozorovatele</Czech>
|
||||||
<Spanish>Ajustes de espectador</Spanish>
|
<Spanish>Ajustes de espectador</Spanish>
|
||||||
</Key>
|
</Key>
|
||||||
<Key ID="STR_ACE_Spectator_Settings_Descripton">
|
<Key ID="STR_ACE_Spectator_Settings_Description">
|
||||||
<English>Configure how the spectator system will operate by default.</English>
|
<English>Configure how the spectator system will operate by default.</English>
|
||||||
<Polish>Skonfiguruj domyślne ustawienia obserwatora.</Polish>
|
<Polish>Skonfiguruj domyślne ustawienia obserwatora.</Polish>
|
||||||
<Portuguese>Configura como o sistema de espectador operará por padrão.</Portuguese>
|
<Portuguese>Configura como o sistema de espectador operará por padrão.</Portuguese>
|
||||||
|
@ -41,20 +41,10 @@ def Paste( data ):
|
|||||||
ccb()
|
ccb()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def getFunctions(filepath):
|
def getFunctions(filepath):
|
||||||
|
|
||||||
selfmodule = (re.search('addons[\W]*([_a-zA-Z0-9]*)', filepath)).group(1)
|
selfmodule = (re.search('addons[\W]*([_a-zA-Z0-9]*)', filepath)).group(1)
|
||||||
|
|
||||||
# print("Checking {0} from {1}".format(filepath,selfmodule))
|
# print("Checking {0} from {1}".format(filepath,selfmodule))
|
||||||
|
|
||||||
def pushClosing(t):
|
|
||||||
closingStack.append(closing.expr)
|
|
||||||
closing << Literal( closingFor[t[0]] )
|
|
||||||
|
|
||||||
def popClosing():
|
|
||||||
closing << closingStack.pop()
|
|
||||||
|
|
||||||
with open(filepath, 'r') as file:
|
with open(filepath, 'r') as file:
|
||||||
content = file.read()
|
content = file.read()
|
||||||
|
|
||||||
@ -66,14 +56,39 @@ def getFunctions(filepath):
|
|||||||
exfuncs = srch.findall(content)
|
exfuncs = srch.findall(content)
|
||||||
exfuncs = sorted(set(exfuncs))
|
exfuncs = sorted(set(exfuncs))
|
||||||
|
|
||||||
allFuncs = []
|
fileFuncs = []
|
||||||
for func in modfuncs:
|
for func in modfuncs:
|
||||||
allFuncs.append("ace_{0}_fnc_{1}".format(selfmodule,func))
|
fileFuncs.append("ace_{0}_fnc_{1}".format(selfmodule,func))
|
||||||
|
|
||||||
for exModule,func in exfuncs:
|
for exModule,func in exfuncs:
|
||||||
allFuncs.append("ace_{0}_fnc_{1}".format(exModule, func))
|
fileFuncs.append("ace_{0}_fnc_{1}".format(exModule, func))
|
||||||
|
|
||||||
return allFuncs
|
return fileFuncs
|
||||||
|
|
||||||
|
|
||||||
|
def getStrings(filepath):
|
||||||
|
selfmodule = (re.search('addons[\W]*([_a-zA-Z0-9]*)', filepath)).group(1)
|
||||||
|
# print("Checking {0} from {1}".format(filepath,selfmodule))
|
||||||
|
|
||||||
|
with open(filepath, 'r') as file:
|
||||||
|
content = file.read()
|
||||||
|
|
||||||
|
srch = re.compile('[^E][CL]STRING\(([_a-zA-Z0-9]*)\)')
|
||||||
|
modfuncs = srch.findall(content)
|
||||||
|
modfuncs = sorted(set(modfuncs))
|
||||||
|
|
||||||
|
srch = re.compile('[^E][CL]STRING\(([_a-zA-Z0-9]*)\)')
|
||||||
|
exfuncs = srch.findall(content)
|
||||||
|
exfuncs = sorted(set(exfuncs))
|
||||||
|
|
||||||
|
fileStrings = []
|
||||||
|
for func in modfuncs:
|
||||||
|
fileStrings.append("STR_ACE_{0}_{1}".format(selfmodule,func))
|
||||||
|
|
||||||
|
# for exModule,func in exfuncs:
|
||||||
|
# fileStrings.append("STR_ACE_{0}_{1}".format(exModule, func))
|
||||||
|
|
||||||
|
return fileStrings
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
|
||||||
@ -82,7 +97,9 @@ def main():
|
|||||||
print("#########################")
|
print("#########################")
|
||||||
|
|
||||||
sqf_list = []
|
sqf_list = []
|
||||||
|
|
||||||
allFunctions = []
|
allFunctions = []
|
||||||
|
allStrings = []
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('-m','--module', help='only search specified module addon folder', required=False, default=".")
|
parser.add_argument('-m','--module', help='only search specified module addon folder', required=False, default=".")
|
||||||
@ -91,21 +108,28 @@ def main():
|
|||||||
for root, dirnames, filenames in os.walk('../addons' + '/' + args.module):
|
for root, dirnames, filenames in os.walk('../addons' + '/' + args.module):
|
||||||
for filename in fnmatch.filter(filenames, '*.sqf'):
|
for filename in fnmatch.filter(filenames, '*.sqf'):
|
||||||
sqf_list.append(os.path.join(root, filename))
|
sqf_list.append(os.path.join(root, filename))
|
||||||
|
for filename in fnmatch.filter(filenames, '*.cpp'):
|
||||||
|
sqf_list.append(os.path.join(root, filename))
|
||||||
|
for filename in fnmatch.filter(filenames, '*.hpp'):
|
||||||
|
sqf_list.append(os.path.join(root, filename))
|
||||||
|
|
||||||
for filename in sqf_list:
|
for filename in sqf_list:
|
||||||
allFunctions = allFunctions + getFunctions(filename)
|
allFunctions = allFunctions + getFunctions(filename)
|
||||||
|
for filename in sqf_list:
|
||||||
|
allStrings = allStrings + getStrings(filename)
|
||||||
|
|
||||||
|
|
||||||
testCode1 = "diag_log text '*********** Scaning for nil functions [count {0}]';".format(len(set(allFunctions)));
|
codeHeader = "diag_log text '*********** Scaning for nil functions [funcs {0} / strings {1}]';".format(len(set(allFunctions)), len(set(allStrings)))
|
||||||
testCode2 = "{ if (isNil _x) then {systemChat format ['%1 is nil', _x]; diag_log text format ['%1 is nil', _x];}} forEach allFunctions;";
|
codeFuncCheck = "{ if (isNil _x) then {systemChat format ['%1 is nil', _x]; diag_log text format ['%1 is nil', _x];}} forEach allFunctions;"
|
||||||
|
codeStringCheck = "{ if (!isLocalized _x) then {systemChat format ['%1 is not in stringtable', _x]; diag_log text format ['%1 is not in stringtable', _x];}} forEach allStrings;"
|
||||||
|
|
||||||
outputCode = "{0} allFunctions = {1}; {2}".format(testCode1, list(set(allFunctions)), testCode2)
|
outputCode = "{0} allFunctions = {1}; allStrings = {2}; {3} {4}".format(codeHeader, list(set(allFunctions)), list(set(allStrings)), codeFuncCheck, codeStringCheck)
|
||||||
|
|
||||||
print(outputCode)
|
print(outputCode)
|
||||||
Paste(outputCode);
|
Paste(outputCode);
|
||||||
|
|
||||||
print ("")
|
print ("")
|
||||||
print ("Copied to clipboard, total func count {0}".format(len(set(allFunctions))))
|
print ("Copied to clipboard, [funcs {0} / strings {1}]'".format(len(set(allFunctions)), len(set(allStrings))))
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
Loading…
Reference in New Issue
Block a user