Author: peter
Date: Sat Sep 19 17:43:26 2009
New Revision: 3433

Log:
initial commit of feature which will detect and change default culture to match 
that of imported EAD document

Modified:
   trunk/lib/QubitXmlImport.class.php

Modified: trunk/lib/QubitXmlImport.class.php
==============================================================================
--- trunk/lib/QubitXmlImport.class.php  Sat Sep 19 17:19:27 2009        (r3432)
+++ trunk/lib/QubitXmlImport.class.php  Sat Sep 19 17:43:26 2009        (r3433)
@@ -157,6 +157,25 @@
       $importDOM->xpath = new DOMXPath($importDOM);
     }
 
+    // switch source culture if langusage is set in an EAD document
+    if ($importSchema == 'ead')
+    {
+      if (is_object($langusage = 
$importDOM->xpath->query('//eadheader/profiledesc/langusage/language/@langcode')))
+      {
+        foreach ($langusage as $language)
+        {
+          $isocode = trim(preg_replace('/[\n\r\s]+/', ' ', 
$language->nodeValue));
+          // 1) convert to Symfony culture code
+          // 2) change sf_user to this culture
+          // 3) make sure record is saved with this culture as default
+          // 4) add an 'error' message to notify user that culture has been 
changed?
+
+          // only use the first langusage value, have to assume this is the 
primary language
+          break;
+        }
+      }
+    }
+
     unset($qubitXmlImport->schemaMap['processXSLT']);
 
     // go through schema map and populate objects/properties

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Qubit Toolkit Commits" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.ca/group/qubit-commits?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to