Trees | Indices | Help |
|
---|
|
1 #!/usr/bin/env python 2 3 from translate.convert import prop2mozfunny 4 from translate.misc import wStringIO 5398 """helper that merges po translations to .inc source without requiring files""" 9 inputfile = wStringIO.StringIO(posource) 10 templatefile = wStringIO.StringIO(incsource) 11 outputfile = wStringIO.StringIO() 12 result = prop2mozfunny.po2inc(inputfile, outputfile, templatefile) 13 outputinc = outputfile.getvalue() 14 print outputinc 15 assert result 16 return outputinc1719 """check that we don't add newlines at the end of file""" 20 posource = '''# converted from #defines file\n#: MOZ_LANG_TITLE\nmsgid "English (US)"\nmsgstr "Deutsch (DE)"\n\n''' 21 inctemplate = '''#define MOZ_LANG_TITLE Deutsch (DE)\n''' 22 incexpected = inctemplate 23 incfile = self.merge2inc(inctemplate, posource) 24 print incfile 25 assert incfile == incexpected2628 """check that we handle uncommenting contributors properly""" 29 posource = '''# converted from #defines file 30 #: MOZ_LANGPACK_CONTRIBUTORS 31 msgid "<em:contributor>Joe Solon</em:contributor>" 32 msgstr "<em:contributor>Mr Fury</em:contributor>" 33 ''' 34 inctemplate = '''# #define MOZ_LANGPACK_CONTRIBUTORS <em:contributor>Joe Solon</em:contributor>\n''' 35 incexpected = '''#define MOZ_LANGPACK_CONTRIBUTORS <em:contributor>Mr Fury</em:contributor>\n''' 36 incfile = self.merge2inc(inctemplate, posource) 37 print incfile 38 assert incfile == incexpected
Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Sep 23 13:51:29 2008 | http://epydoc.sourceforge.net |