← Back to team overview

openshot.code team mailing list archive

[Branch ~openshot.code/openshot/translations] Rev 834: Added Qt's .ts file to this script, which is used by OpenShot 2.0

 

------------------------------------------------------------
revno: 834
committer: Jonathan Thomas <Jonathan.Oomph@xxxxxxxxx>
branch nick: translations
timestamp: Tue 2014-03-11 15:24:46 -0500
message:
  Added Qt's .ts file to this script, which is used by OpenShot 2.0
modified:
  compile.py


--
lp:~openshot.code/openshot/translations
https://code.launchpad.net/~openshot.code/openshot/translations

Your team OpenShot Code is subscribed to branch lp:~openshot.code/openshot/translations.
To unsubscribe from this branch go to https://code.launchpad.net/~openshot.code/openshot/translations/+edit-subscription
=== modified file 'compile.py'
--- compile.py	2010-02-08 00:40:39 +0000
+++ compile.py	2014-03-11 20:24:46 +0000
@@ -27,23 +27,31 @@
 locale_folder = os.path.join(path, "openshot", "locale", "OpenShot")
 
 # Compile all PO files into MO files
-subprocess.call('find -iname "*.po" -exec msgfmt {} -o {}.mo \;', shell=True)
+#subprocess.call('find -iname "*.po" -exec msgfmt {} -o {}.mo \;', shell=True)
+#subprocess.call('find -iname "*.po" -exec po2ts {} -o {}.ts \;', shell=True)
 
 # Loop through each MO file
 for file in os.listdir(locale_folder):
 	# only look for MO files
-	if "mo" in file:
+	if ".mo" in file or ".ts" in file or ".po" in file:
 		# Get the culture code from the file name
 		culture = str.split(file, ".")[0]
+		extension = str.split(file, ".")[-1]
 		
 		# Create directory
 		if not os.path.exists(os.path.join(locale_folder, culture)):
 			os.mkdir(os.path.join(locale_folder, culture))
 			os.mkdir(os.path.join(locale_folder, culture, "LC_MESSAGES"))
 		
-		# Copy MO file into the new folder
-		shutil.copy(os.path.join(locale_folder, file), os.path.join(locale_folder, culture, "LC_MESSAGES", "OpenShot.mo"))
-		shutil.copy(os.path.join(locale_folder, "%s.po" % culture), os.path.join(locale_folder, culture, "LC_MESSAGES", "OpenShot.po"))
-		
-		# Remove root MO file
-		os.remove(os.path.join(locale_folder, file))
\ No newline at end of file
+		# Copy file into the new folder
+		shutil.copy(os.path.join(locale_folder, file), os.path.join(locale_folder, culture, "LC_MESSAGES", "OpenShot.%s" % extension))
+		
+		# Clean up files
+		if extension == "po":
+			# Make a copy of the PO file in the target folder
+			shutil.copy(os.path.join(locale_folder, "%s.po" % culture), os.path.join(locale_folder, culture, "LC_MESSAGES", "OpenShot.po"))
+		else:
+			# Remove MO, and TS files from the root folder
+			os.remove(os.path.join(locale_folder, file))
+		
+		
\ No newline at end of file