From: <dwa...@us...> - 2008-10-31 14:26:23
|
Revision: 8854 http://translate.svn.sourceforge.net/translate/?rev=8854&view=rev Author: dwaynebailey Date: 2008-10-31 14:26:16 +0000 (Fri, 31 Oct 2008) Log Message: ----------- Store the escape type in the phpunit Modified Paths: -------------- src/trunk/translate/storage/php.py Modified: src/trunk/translate/storage/php.py =================================================================== --- src/trunk/translate/storage/php.py 2008-10-31 13:48:06 UTC (rev 8853) +++ src/trunk/translate/storage/php.py 2008-10-31 14:26:16 UTC (rev 8854) @@ -56,7 +56,7 @@ return text return text.replace("%s" % quotechar, "\\%s" % quotechar).replace("\n", "\\n") -def phpdecode(text): +def phpdecode(text, quotechar="'"): """convert PHP escaped string to a Python string""" if not text: return text @@ -67,6 +67,7 @@ associated""" def __init__(self, source=""): """construct a blank phpunit""" + self.escape_type = None super(phpunit, self).__init__(source) self.name = "" self.value = "" @@ -75,10 +76,10 @@ def setsource(self, source): """Sets the source AND the target to be equal""" - self.value = phpencode(source) + self.value = phpencode(source, self.escape_type) def getsource(self): - return phpdecode(self.value) + return phpdecode(self.value, self.escape_type) source = property(getsource, setsource) def settarget(self, target): @@ -172,6 +173,7 @@ while colonpos != -1: if value[colonpos-1] == valuequote: newunit.value = lastvalue + value[:colonpos-1] + newunit.escape_type = valuequote lastvalue = "" invalue = False if not invalue and colonpos != len(value)-1: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |