[gnomeweb-wp: 9/13] merges all the content changes with the existing po files



commit 919809980df351cb994444bd67d6ef5655adc49a
Author: Vinicius Depizzol <vdepizzol gmail com>
Date:   Wed Jan 26 02:06:59 2011 -0200

    merges all the content changes with the existing po files

 wp-content/plugins/wppo/wppo.php |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/wp-content/plugins/wppo/wppo.php b/wp-content/plugins/wppo/wppo.php
index 1a50f78..6c36330 100644
--- a/wp-content/plugins/wppo/wppo.php
+++ b/wp-content/plugins/wppo/wppo.php
@@ -42,6 +42,20 @@ function wppo_update_pot_file ($post) {
   $xml_file = PO_DIR . "gnomesite.xml";
   file_put_contents ($xml_file, wppo_generate_po_xml ());
   exec ("/usr/bin/xml2po -o " . POT_FILE . " $xml_file");
+  
+  /* Update all the existing po files to handle the modifications in the
+   * content using xml2po -u
+   */
+  if ($handle = opendir (PO_DIR)) {
+    while (false !== ($po_file = readdir ($handle))) {
+    
+      /* Gets all the .po files from PO_DIR. */
+      if (strpos ($po_file, '.po', 1) !== false && strpos ($po_file, '.pot', 1) === false) {
+        exec ("/usr/bin/xml2po -u $po_file $xml_file");
+      }
+    }
+  }
+  
 }
 add_action ('post_updated', 'wppo_update_pot_file');
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]