[gnome-web-wppo] added ITS rules



commit fa937d812cc41b84b8d6064714018b3d0e989179
Author: Vinicius Depizzol <vdepizzol gmail com>
Date:   Mon Mar 12 01:01:03 2012 -0300

    added ITS rules

 backend.php |    7 ++++---
 wppo.its    |   52 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 wppo.php    |    3 ++-
 3 files changed, 58 insertions(+), 4 deletions(-)
---
diff --git a/backend.php b/backend.php
index 047f2f0..ab28929 100644
--- a/backend.php
+++ b/backend.php
@@ -53,10 +53,11 @@ function wppo_update_pot($coverage = array('dynamic', 'static')) {
         
         $pot_file = WPPO_DIR.$post_type.".pot";
         $xml_file = WPPO_DIR.$post_type.".xml";
+        $its_rules_file = WPPO_PLUGIN_DIR.'wppo.its';
         
         wppo_update_xml($post_type);
         
-        $output = shell_exec(WPPO_ITSTOOL_COMMAND." -o ".escapeshellarg($pot_file)." ".escapeshellarg($xml_file)." 2>&1");
+        $output = shell_exec(WPPO_ITSTOOL_COMMAND." -i ".escapeshellarg($its_rules_file)." -o ".escapeshellarg($pot_file)." ".escapeshellarg($xml_file)." 2>&1");
         
         if (trim($output) != '') {
             $wppo_error['xml2pot'][$post_type] = $output;
@@ -217,7 +218,7 @@ function wppo_check_for_po_changes($force = false, $coverage = array('dynamic',
             $translated_xml_file = WPPO_DIR.$post_type.'/xml/'.$lang.'.xml';
             $mo_file             = WPPO_DIR.$post_type.'/mo/'.$lang.'.mo';
             
-            $compile_command = WPPO_MSGFMT_COMMAND." ".escapeshellarg($po_file)." -o ".escapeshellarg($mo_file)." 2>&1";
+            $compile_command = WPPO_MSGFMT_COMMAND." ".escapeshellarg($po_file)." -o ".escapeshellarg($mo_file)." -i ".escapeshellarg($its_rules_file)." 2>&1";
             $msgfmt_output = shell_exec($compile_command);
 
             if (trim($msgfmt_output) != '') {
@@ -226,7 +227,7 @@ function wppo_check_for_po_changes($force = false, $coverage = array('dynamic',
                 
             } else {
             
-                $command = WPPO_ITSTOOL_COMMAND." -m ".escapeshellarg($mo_file)." -o ".escapeshellarg($translated_xml_file)." ".escapeshellarg($original_xml_file)." 2>&1";
+                $command = WPPO_ITSTOOL_COMMAND." -m ".escapeshellarg($mo_file)." -o ".escapeshellarg($translated_xml_file)." ".escapeshellarg($original_xml_file)." -i ".escapeshellarg($its_rules_file)." 2>&1";
                 $output = shell_exec($command);
                 
                 if (trim($output) == '') {
diff --git a/wppo.its b/wppo.its
new file mode 100644
index 0000000..596297d
--- /dev/null
+++ b/wppo.its
@@ -0,0 +1,52 @@
+<its:rules
+    xmlns:its="http://www.w3.org/2005/11/its";
+    xmlns:itst="http://itstool.org/extensions/";
+    xmlns:html="http://www.w3.org/1999/xhtml";
+    its:version="1.0">
+    
+    <its:translateRule translate="no" selector="//script"/>
+    <its:translateRule translate="no" selector="//style"/>
+    
+    <itst:preserveSpaceRule preserveSpace="yes" selector="//pre"/>
+    
+    <its:translateRule translate="yes" selector="//img[ alt != '']/@alt"/>
+    <its:translateRule translate="yes" selector="//input[ placeholder != '']/@placeholder"/>
+    <its:translateRule translate="yes" selector="//textarea[ placeholder != '']/@textarea"/>
+    <its:translateRule translate="yes" selector="//table[ summary != '']/@summary"/>
+    <its:translateRule translate="yes" selector="//*[ title != '']/@title"/>
+    
+    <!--<its:withinTextRule withinText="yes" selector="//a"/>-->
+    <its:withinTextRule withinText="yes" selector="//abbr"/>
+    <its:withinTextRule withinText="yes" selector="//acronym"/>
+    <its:withinTextRule withinText="yes" selector="//b"/>
+    <its:withinTextRule withinText="yes" selector="//bdo"/>
+    <its:withinTextRule withinText="yes" selector="//big"/>
+    <its:withinTextRule withinText="yes" selector="//br"/>
+    <its:withinTextRule withinText="yes" selector="//center"/>
+    <its:withinTextRule withinText="yes" selector="//cite"/>
+    <its:withinTextRule withinText="yes" selector="//code"/>
+    <its:withinTextRule withinText="yes" selector="//del"/>
+    <its:withinTextRule withinText="yes" selector="//dfn"/>
+    <its:withinTextRule withinText="yes" selector="//em"/>
+    <its:withinTextRule withinText="yes" selector="//font"/>
+    <its:withinTextRule withinText="yes" selector="//hr"/>
+    <its:withinTextRule withinText="yes" selector="//i"/>
+    <!--<its:withinTextRule withinText="yes" selector="//img"/>-->
+    <its:withinTextRule withinText="yes" selector="//ins"/>
+    <its:withinTextRule withinText="yes" selector="//isindex"/>
+    <its:withinTextRule withinText="yes" selector="//kbd"/>
+    <its:withinTextRule withinText="yes" selector="//pre/*"/>
+    <its:withinTextRule withinText="yes" selector="//q"/>
+    <its:withinTextRule withinText="yes" selector="//s"/>
+    <its:withinTextRule withinText="yes" selector="//samp"/>
+    <its:withinTextRule withinText="yes" selector="//small"/>
+    <its:withinTextRule withinText="yes" selector="//span"/>
+    <its:withinTextRule withinText="yes" selector="//strike"/>
+    <its:withinTextRule withinText="yes" selector="//strong"/>
+    <its:withinTextRule withinText="yes" selector="//sub"/>
+    <its:withinTextRule withinText="yes" selector="//sup"/>
+    <its:withinTextRule withinText="yes" selector="//tt"/>
+    <its:withinTextRule withinText="yes" selector="//u"/>
+    <its:withinTextRule withinText="yes" selector="//var"/>
+    
+</its:rules>
diff --git a/wppo.php b/wppo.php
index 5706503..278ea05 100644
--- a/wppo.php
+++ b/wppo.php
@@ -53,7 +53,8 @@ define('WPPO_URI_SCHEME', 'http');
 
 define('WPPO_ABS_URI', $_SERVER['REQUEST_URI']);
 define('WPPO_HOME_URL', home_url());
-define('WPPO_PLUGIN_FILE', WP_PLUGIN_DIR.'/wppo/wppo.php');
+define('WPPO_PLUGIN_DIR', WP_PLUGIN_DIR.'/wppo/');
+define('WPPO_PLUGIN_FILE', WPPO_PLUGIN_DIR.'wppo.php');
 
 define('WPPO_DEFAULT_LANGUAGE_NAME', 'English');
 define('WPPO_DEFAULT_LANGUAGE_CODE', 'en');



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