mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Update sandbox/check_trans.py and run automatically run pygettext.
This commit is contained in:
parent
4754df2dbd
commit
de0087c8c2
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import subprocess
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
directory = sys.argv[1]
|
directory = sys.argv[1]
|
||||||
@ -10,13 +11,22 @@ def main():
|
|||||||
continue
|
continue
|
||||||
checkPlugin(os.path.join(directory, plugin))
|
checkPlugin(os.path.join(directory, plugin))
|
||||||
|
|
||||||
|
def changedir(f):
|
||||||
|
def newf(new_path):
|
||||||
|
old_path = os.getcwd()
|
||||||
|
os.chdir(new_path)
|
||||||
|
try:
|
||||||
|
return f('.')
|
||||||
|
finally:
|
||||||
|
os.chdir(old_path)
|
||||||
|
return newf
|
||||||
|
|
||||||
|
|
||||||
|
@changedir
|
||||||
def checkPlugin(pluginPath):
|
def checkPlugin(pluginPath):
|
||||||
try:
|
subprocess.Popen('pygettext -D config.py plugin.py', shell=True).wait()
|
||||||
pot = open(os.path.join(pluginPath, 'messages.pot'))
|
pot = open(os.path.join(pluginPath, 'messages.pot'))
|
||||||
except IOError: # Does not exist
|
localePath = os.path.join(pluginPath, 'locales')
|
||||||
print 'WARNING: %s has no messages.pot' % pluginPath
|
|
||||||
return
|
|
||||||
localePath = os.path.join(pluginPath, 'locale')
|
|
||||||
for translation in os.listdir(localePath):
|
for translation in os.listdir(localePath):
|
||||||
if not translation.endswith('.po'):
|
if not translation.endswith('.po'):
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user