[aur-dev] [PATCH] Don't add closing PHP tag to translation files.

Loui louipc.ist at gmail.com
Tue Jul 22 18:22:13 EDT 2008


Closing PHP tags (?>) can cause problems with XML and extra
whitespace when they aren't really needed.

-------------- next part --------------
>From c2629ec0f6eef566a31e1b796622c2690ccb6d09 Mon Sep 17 00:00:00 2001
From: Loui Chang <louipc.ist at gmail.com>
Date: Tue, 22 Jul 2008 18:16:23 -0400
Subject: [PATCH] Don't add closing PHP tag to translation files.

Signed-off-by: Loui Chang <louipc.ist at gmail.com>
---
 web/utils/genpopo          |    2 +-
 web/utils/translation_tool |    9 ++++-----
 2 files changed, 5 insertions(+), 6 deletions(-)

diff --git a/web/utils/genpopo b/web/utils/genpopo
index bfe3492..67c0228 100755
--- a/web/utils/genpopo
+++ b/web/utils/genpopo
@@ -232,7 +232,7 @@ else:
 			if term not in existing_terms:
 				f.write("\n");
 				f.write('$_t["en"]["%s"] = "%s";\n' % (term, term))
-		f.write("\n?>");
+		f.write("\n");
 		f.close()
 
 # Print out warnings for unused and little-used common entries.
diff --git a/web/utils/translation_tool b/web/utils/translation_tool
index ae9ae1d..6967139 100755
--- a/web/utils/translation_tool
+++ b/web/utils/translation_tool
@@ -172,7 +172,7 @@ if force:
 		f = open(po,'w')
 		f.write(INC_HEADER)
 		f.write('\ninclude_once(\"en/%s\");\n' % po)
-		f.write('\n?>')
+		f.write('\n')
 		f.close()
 
 		f = open(trans_dir+"/"+po,'w')
@@ -183,7 +183,6 @@ if force:
 			trans = raw_input(term+"  = ")
 			f.write('$_t["%s"]["%s"] = "%s";\n' % (trans_abbrv, term, trans))
 		f.write("\n");
-		f.write("?>");
 		f.close()
 else:
 	# need to leave existing file intact, and only append on terms that are new
@@ -216,13 +215,13 @@ else:
 				f = open(po,'w')
 				f.write("".join(contents))
 				f.write('\ninclude_once(\"%s/%s\");\n' % (trans_abbrv, po))
-				f.write("\n?>");
+				f.write("\n");
 				f.close()
 		else:
 			f = open(po,'w')
 			f.write(INC_HEADER)
 			f.write('\ninclude_once(\"%s/%s\");\n' % (trans_abbrv, po))
-			f.write('\n?>')
+			f.write('\n')
 			f.close()
 		# first read in file contents so we can hash what already exists
 		#
@@ -264,7 +263,7 @@ else:
 				f.write("\n");
 				trans = raw_input(term+"  = ")
 				f.write('$_t["%s"]["%s"] = "%s";\n' % (trans_abbrv, term, trans))
-		f.write("\n?>");
+		f.write("\n");
 		f.close()
 
 # Print out warnings for unused and little-used common entries.
-- 
1.5.6.4



More information about the aur-dev mailing list