Back to index

plone3  3.1.7
filter.py
Go to the documentation of this file.
00001 """
00002    Usage: filter.py <target-product> <source-product>
00003 
00004    Filter out all msgid's in target product that are already in source product.
00005 """
00006 
00007 import os, sys
00008 
00009 __I18NDUDE = os.environ.get('I18NDUDE', 'i18ndude')
00010 
00011 def main():
00012     if len(sys.argv) < 3:
00013         print 'You have to specify the target and source product.'
00014         sys.exit(1)
00015 
00016     target = sys.argv[1]+'.pot'
00017     source = sys.argv[2]+'.pot'
00018 
00019     os.chdir('..')
00020     os.chdir('i18n')
00021 
00022     if not os.path.isfile(source):
00023         print 'Source pot was not found for the given product.'
00024         sys.exit(2)
00025 
00026     if not os.path.isfile(target):
00027         print 'Target pot was not found for the given product.'
00028         sys.exit(3)
00029 
00030     os.system(__I18NDUDE + (' filter %s %s > %s-new') % (target, source, target))
00031 
00032 if __name__ == '__main__':
00033     main()