public static function buildMessages( Translations $translations ) {
		$plural_forms      = $translations->getPluralForms();
		$number_of_plurals = is_array( $plural_forms ) ? ( $plural_forms[0] - 1 ) : null;
		$messages          = [];
		$context_glue      = chr( 4 );

		foreach ( $translations as $translation ) {
			/** @var Translation $translation */

			if ( $translation->isDisabled() ) {
				continue;
			}

			$key = $translation->getOriginal();

			if ( $translation->hasContext() ) {
				$key = $translation->getContext() . $context_glue . $key;
			}

			if ( $translation->hasPluralTranslations( true ) ) {
				$message = $translation->getPluralTranslations( $number_of_plurals );
				array_unshift( $message, $translation->getTranslation() );
			} else {
				$message = [ $translation->getTranslation() ];
			}

			$messages[ $key ] = $message;
		}

		return $messages;
	}
public static function buildMessages( Translations $translations ) {
		$plural_forms      = $translations->getPluralForms();
		$number_of_plurals = is_array( $plural_forms ) ? ( $plural_forms[0] - 1 ) : null;
		$messages          = [];
		$context_glue      = chr( 4 );

		foreach ( $translations as $translation ) {
			/** @var Translation $translation */

			if ( $translation->isDisabled() ) {
				continue;
			}

			$key = $translation->getOriginal();

			if ( $translation->hasContext() ) {
				$key = $translation->getContext() . $context_glue . $key;
			}

			if ( $translation->hasPluralTranslations( true ) ) {
				$message = $translation->getPluralTranslations( $number_of_plurals );
				array_unshift( $message, $translation->getTranslation() );
			} else {
				$message = [ $translation->getTranslation() ];
			}

			$messages[ $key ] = $message;
		}

		return $messages;
	}
public static function buildMessages ( Translations $ translations ) { $ plural_forms = $ translations -> getPluralForms ( ) ; $ number_of_plurals = is_array ( $ plural_forms ) ? ( $ plural_forms [ 0 ] - 1 ) : null ; $ messages = [ ] ; $ context_glue = chr ( 4 ) ; foreach ( $ translations as $ translation ) { /** @var Translation $translation */ if ( $ translation -> isDisabled ( ) ) { continue ; } $ key = $ translation -> getOriginal ( ) ; if ( $ translation -> hasContext ( ) ) { $ key = $ translation -> getContext ( ) . $ context_glue . $ key ; } if ( $ translation -> hasPluralTranslations ( true ) ) { $ message = $ translation -> getPluralTranslations ( $ number_of_plurals ) ; array_unshift ( $ message , $ translation -> getTranslation ( ) ) ; } else { $ message = [ $ translation -> getTranslation ( ) ] ; } $ messages [ $ key ] = $ message ; } return $ messages ; }
Generates an array with all translations.

@param Translations $translations

@return array
Generates an array with all translations .