diff --git a/workflow/engine/classes/model/Translation.php b/workflow/engine/classes/model/Translation.php index 3a3dc25e0..0b6e0d8f9 100755 --- a/workflow/engine/classes/model/Translation.php +++ b/workflow/engine/classes/model/Translation.php @@ -498,7 +498,7 @@ class Translation extends BaseTranslation } } - return $environments; + return $this->sortByColumn($environments, 'LANGUAGE'); /* G::LoadSystem('dbMaintenance'); @@ -520,6 +520,31 @@ class Translation extends BaseTranslation */ } + /** + * Sorts an array according to a specified column + * Params : array $table + * string $colname + * bool $numeric + **/ + public function sortByColumn($table, $colname) { + $tn = $ts = $temp_num = $temp_str = array(); + foreach ($table as $key => $row) { + if(is_numeric(substr($row[$colname], 0, 1))) { + $tn[$key] = $row[$colname]; + $temp_num[$key] = $row; + } + else { + $ts[$key] = $row[$colname]; + $temp_str[$key] = $row; + } + } + unset($table); + + array_multisort($tn, SORT_ASC, SORT_NUMERIC, $temp_num); + array_multisort($ts, SORT_ASC, SORT_STRING, $temp_str); + return array_merge($temp_num, $temp_str); + } + public function getInfoFromPOFile ($file) { G::loadClass( 'i18n_po' );