def _loadPoFile(self, poFilename): ''' Load the translation from a .po file by creating a python module with po2dict and them importing that module. ''' language = self._languageFromPoFilename(poFilename) pyFilename = self._tmpPyFilename() po2dict.make(poFilename, pyFilename) module = imp.load_source(language, pyFilename) os.remove(pyFilename) return module, language
def processDir(outdir): catalogs = ['en_US'] for poFile in glob.glob('i18n.in/*.po'): print poFile pyFile = po2dict.make(poFile) shutil.move(pyFile, '%s/%s' % (outdir, os.path.basename(pyFile))) catalogs.append(os.path.splitext(os.path.basename(pyFile))[0]) fh = open('%s/%s' % (outdir, 'peppy_message_catalogs.py'), 'w') fh.write("supplied_translations = %s" % str(catalogs))
import glob, po2dict, shutil for poFile in glob.glob('*.po'): print poFile pyFile = po2dict.make(poFile) shutil.move(pyFile, '../peppy/i18n/%s' % pyFile)
import glob, po2dict, shutil for poFile in glob.glob('*.po'): print poFile pyFile = po2dict.make(poFile) shutil.move(pyFile, '../peppy/i18n/%s'%pyFile)