public static function serializeAnnotations($annotations)
    {
        $returnValue = (string) '';

        
        // Buffer will contain each line of the serialized PO comment block.
        $buffer = array();
        
        foreach ($annotations as $name => $value){
            $prefix = null;
            
            switch ($name){
                case tao_helpers_translation_POTranslationUnit::TRANSLATOR_COMMENTS:
                    $prefix = '#';
                break;
                
                case tao_helpers_translation_POTranslationUnit::EXTRACTED_COMMENTS:
                    $prefix = '#.';    
                break;
                
                case tao_helpers_translation_POTranslationUnit::REFERENCE:
                    $prefix = '#:';
                break;
                
                case tao_helpers_translation_POTranslationUnit::FLAGS:
                    $prefix = '#,';
                break;
                
                case tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGID:
                case tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGID_PLURAL:
                case tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGCTXT:
                    $prefix = '#|';
                break;
            }
            
            if ($prefix !== null){
                // We have a PO compliant annotation that we have to serialize.
                foreach(explode("\n", $value) as $v){
                    $buffer[] = "${prefix} ${v}";
                }
            }
        }

        // Glue the annotation lines in a single PO comment block.
        $returnValue = implode("\n", $buffer);
        

        return (string) $returnValue;
    }
public static function serializeAnnotations($annotations)
    {
        $returnValue = (string) '';

        
        // Buffer will contain each line of the serialized PO comment block.
        $buffer = array();
        
        foreach ($annotations as $name => $value){
            $prefix = null;
            
            switch ($name){
                case tao_helpers_translation_POTranslationUnit::TRANSLATOR_COMMENTS:
                    $prefix = '#';
                break;
                
                case tao_helpers_translation_POTranslationUnit::EXTRACTED_COMMENTS:
                    $prefix = '#.';    
                break;
                
                case tao_helpers_translation_POTranslationUnit::REFERENCE:
                    $prefix = '#:';
                break;
                
                case tao_helpers_translation_POTranslationUnit::FLAGS:
                    $prefix = '#,';
                break;
                
                case tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGID:
                case tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGID_PLURAL:
                case tao_helpers_translation_POTranslationUnit::PREVIOUS_MSGCTXT:
                    $prefix = '#|';
                break;
            }
            
            if ($prefix !== null){
                // We have a PO compliant annotation that we have to serialize.
                foreach(explode("\n", $value) as $v){
                    $buffer[] = "${prefix} ${v}";
                }
            }
        }

        // Glue the annotation lines in a single PO comment block.
        $returnValue = implode("\n", $buffer);
        

        return (string) $returnValue;
    }
public static function serializeAnnotations ( $ annotations ) { $ returnValue = ( string ) '' ; // Buffer will contain each line of the serialized PO comment block. $ buffer = array ( ) ; foreach ( $ annotations as $ name => $ value ) { $ prefix = null ; switch ( $ name ) { case tao_helpers_translation_POTranslationUnit :: TRANSLATOR_COMMENTS : $ prefix = '#' ; break ; case tao_helpers_translation_POTranslationUnit :: EXTRACTED_COMMENTS : $ prefix = '#.' ; break ; case tao_helpers_translation_POTranslationUnit :: REFERENCE : $ prefix = '#:' ; break ; case tao_helpers_translation_POTranslationUnit :: FLAGS : $ prefix = '#,' ; break ; case tao_helpers_translation_POTranslationUnit :: PREVIOUS_MSGID : case tao_helpers_translation_POTranslationUnit :: PREVIOUS_MSGID_PLURAL : case tao_helpers_translation_POTranslationUnit :: PREVIOUS_MSGCTXT : $ prefix = '#|' ; break ; } if ( $ prefix !== null ) { // We have a PO compliant annotation that we have to serialize. foreach ( explode ( "\n" , $ value ) as $ v ) { $ buffer [ ] = "${prefix} ${v}" ; } } } // Glue the annotation lines in a single PO comment block. $ returnValue = implode ( "\n" , $ buffer ) ; return ( string ) $ returnValue ; }
Serialize an array of annotations in a PO compliant comments format.

@access public
@author Jerome Bogaerts, <jerome.bogaerts@tudor.lu>
@param  array annotations An array of annotations where keys are annotation identifiers and values are annotation values.
@return string
Serialize an array of annotations in a PO compliant comments format .