mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 02:49:27 +01:00
sandbox: Update check_trans.py to handle core locales.
This commit is contained in:
parent
d8df5cc650
commit
5c118ded7c
@ -2,14 +2,18 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
import glob
|
||||
import subprocess
|
||||
|
||||
def main():
|
||||
directory = sys.argv[1]
|
||||
for plugin in os.listdir(directory):
|
||||
if plugin[0] not in 'AZERTYUIOPQSDFGHJKLMWXCVBN':
|
||||
continue
|
||||
checkPlugin(os.path.join(directory, plugin))
|
||||
if directory == '--core':
|
||||
checkCore()
|
||||
else:
|
||||
for plugin in os.listdir(directory):
|
||||
if plugin[0] not in 'AZERTYUIOPQSDFGHJKLMWXCVBN':
|
||||
continue
|
||||
checkPlugin(os.path.join(directory, plugin))
|
||||
|
||||
def changedir(f):
|
||||
def newf(new_path):
|
||||
@ -21,6 +25,25 @@ def changedir(f):
|
||||
os.chdir(old_path)
|
||||
return newf
|
||||
|
||||
def checkCore():
|
||||
_checkCore(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
@changedir
|
||||
def _checkCore(corePath):
|
||||
subprocess.Popen(['pygettext', '-p', 'locales', 'plugins/__init__.py'] + glob.glob('src/*.py') + glob.glob('src/*/*.py')).wait()
|
||||
localePath = os.path.join(corePath, 'locales')
|
||||
pot = open(os.path.join(localePath, 'messages.pot'))
|
||||
for translation in os.listdir(localePath):
|
||||
if not translation.endswith('.po'):
|
||||
continue
|
||||
pot.seek(0)
|
||||
potPath = os.path.join(os.getcwd(), 'locales', translation)
|
||||
po = open(potPath)
|
||||
if checkTranslation(pot, po):
|
||||
print 'OK: ' + potPath
|
||||
else:
|
||||
print 'ERROR: ' + potPath
|
||||
|
||||
|
||||
@changedir
|
||||
def checkPlugin(pluginPath):
|
||||
|
Loading…
Reference in New Issue
Block a user