base for translation
This commit is contained in:
parent
98bd5362c3
commit
f338a0c944
3 changed files with 5916 additions and 1 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -58,7 +58,6 @@ platform/android/libs/play_licensing/gen/*
|
|||
*.os
|
||||
*.Plo
|
||||
*.lo
|
||||
*.Po
|
||||
|
||||
# Libs generated files
|
||||
.deps/*
|
||||
|
|
5856
tools/translations/base.po
Normal file
5856
tools/translations/base.po
Normal file
File diff suppressed because it is too large
Load diff
60
tools/translations/extract.py
Normal file
60
tools/translations/extract.py
Normal file
|
@ -0,0 +1,60 @@
|
|||
#!/bin/python
|
||||
|
||||
import fnmatch
|
||||
import os
|
||||
import re
|
||||
|
||||
matches = []
|
||||
for root, dirnames, filenames in os.walk('.'):
|
||||
for filename in fnmatch.filter(filenames, '*.cpp'):
|
||||
if (filename.find("collada")!=-1):
|
||||
continue
|
||||
matches.append(os.path.join(root, filename))
|
||||
for filename in fnmatch.filter(filenames, '*.h'):
|
||||
if (filename.find("collada")!=-1):
|
||||
continue
|
||||
matches.append(os.path.join(root, filename))
|
||||
|
||||
|
||||
unique_str=[]
|
||||
main_po=""
|
||||
|
||||
for fname in matches:
|
||||
|
||||
f = open(fname,"rb")
|
||||
|
||||
new_f = ""
|
||||
|
||||
l = f.readline()
|
||||
lc=1
|
||||
while(l):
|
||||
|
||||
pos = 0
|
||||
while(pos>=0):
|
||||
pos = l.find('TTR(\"',pos)
|
||||
if (pos==-1):
|
||||
break
|
||||
pos+=5
|
||||
|
||||
msg=""
|
||||
while (pos < len(l) and (l[pos]!='"' or l[pos-1]=='\\') ):
|
||||
msg+=l[pos]
|
||||
pos+=1
|
||||
|
||||
if (not msg in unique_str):
|
||||
main_po+="\n#:"+fname+":"+str(lc)+"\n"
|
||||
main_po+='msgid "'+msg+'"\n'
|
||||
main_po+='msgstr ""\n'
|
||||
unique_str.append(msg)
|
||||
|
||||
l = f.readline()
|
||||
lc+=1
|
||||
|
||||
f.close()
|
||||
|
||||
|
||||
f = open("base.po","wb")
|
||||
f.write(main_po)
|
||||
f.close()
|
||||
|
||||
|
Loading…
Reference in a new issue