comanage-dev - [comanage-dev] r585 - registry/trunk/app/Lib
Subject: COmanage Developers List
List archive
- From:
- To:
- Subject: [comanage-dev] r585 - registry/trunk/app/Lib
- Date: Thu, 5 Sep 2013 19:25:54 -0400
Author: benno
Date: 2013-09-05 19:25:54 -0400 (Thu, 05 Sep 2013)
New Revision: 585
Modified:
registry/trunk/app/Lib/lang.php
registry/trunk/app/Lib/util.php
Log:
Support Eastern name order (CO-577)
Modified: registry/trunk/app/Lib/lang.php
===================================================================
--- registry/trunk/app/Lib/lang.php 2013-09-05 23:24:47 UTC (rev 584)
+++ registry/trunk/app/Lib/lang.php 2013-09-05 23:25:54 UTC (rev 585)
@@ -247,6 +247,7 @@
'id' => 'Indonesian (Bahasa Indonesia)',
'it' => 'Italian (Italiano)',
'ja' => 'Japanese (日本語)',
+ 'ko' => 'Korean (한국어)',
'lv' => 'Latvian (Latviešu Valoda)',
'lt' => 'Lithuanian (Lietuvių Kalba)',
'ms' => 'Malaysian (Bahasa Malaysia)',
Modified: registry/trunk/app/Lib/util.php
===================================================================
--- registry/trunk/app/Lib/util.php 2013-09-05 23:24:47 UTC (rev 584)
+++ registry/trunk/app/Lib/util.php 2013-09-05 23:25:54 UTC (rev 585)
@@ -68,27 +68,41 @@
function generateCn($name, $showHonorific = false)
{
- // XXX need international name order checking (Given FAMILY vs FAMILY
Given)
-
+ // Name order is a bit tricky. We'll use the language encoding as our
hint, although
+ // it isn't perfect. This could be replaced with a more sophisticated test
as
+ // requirements evolve.
+
$cn = "";
- // Does not show honorific by default
- if( $showHonorific && ($name['honorific'] != "") )
- $cn .= ($cn != "" ? ' ' : '') . $name['honorific'];
+ if(empty($name['language'])
+ || !in_array($name['language'], array('hu', 'ja', 'ko', 'za-Hans',
'za-Hant'))) {
+ // Western order. Do not show honorific by default.
+
+ if( $showHonorific && ($name['honorific'] != "") )
+ $cn .= ($cn != "" ? ' ' : '') . $name['honorific'];
+
+ if($name['given'] != "")
+ $cn .= ($cn != "" ? ' ' : '') . $name['given'];
+
+ if($name['middle'] != "")
+ $cn .= ($cn != "" ? ' ' : '') . $name['middle'];
+
+ if($name['family'] != "")
+ $cn .= ($cn != "" ? ' ' : '') . $name['family'];
+
+ if($name['suffix'] != "")
+ $cn .= ($cn != "" ? ' ' : '') . $name['suffix'];
+ } else {
+ // Switch to Eastern order. It's not clear what to do with some
components.
+
+ if($name['family'] != "")
+ $cn .= ($cn != "" ? ' ' : '') . $name['family'];
+
+ if($name['given'] != "")
+ $cn .= ($cn != "" ? ' ' : '') . $name['given'];
+ }
- if($name['given'] != "")
- $cn .= ($cn != "" ? ' ' : '') . $name['given'];
-
- if($name['middle'] != "")
- $cn .= ($cn != "" ? ' ' : '') . $name['middle'];
-
- if($name['family'] != "")
- $cn .= ($cn != "" ? ' ' : '') . $name['family'];
-
- if($name['suffix'] != "")
- $cn .= ($cn != "" ? ' ' : '') . $name['suffix'];
-
- return($cn);
+ return $cn;
}
/**
- [comanage-dev] r585 - registry/trunk/app/Lib, svnlog, 09/05/2013
Archive powered by MHonArc 2.6.16.