public function getTranslations( $category = null ) : array
   {

      $translations = [];

      // If no category is defined (must be NULL) return all translations without a
      if ( \is_null( $category ) )
      {

         foreach ( $this->_translations as $identifier => $transData )
         {
            if ( is_string( $transData ) )
            {
               $translations[ $identifier ] = $transData;
               continue;
            }
            if ( ! \is_array( $transData ) || ! isset( $transData[ 'text' ] ) )
            {
               continue;
            }
            $translations[ $identifier ] = $transData[ 'text' ];
         }

         return $translations;

      }

      $category     = \trim( $category );
      $withCategory = \strlen( $category ) > 0;

      $this->getCategories();

      if ( ! \in_array( $category, $this->_categories ) && $category !== '' )
      {
         return $translations;
      }

      foreach ( $this->_translations as $identifier => $transData )
      {

         if ( $withCategory )
         {
            if ( ! \is_array( $transData ) ||
                 ! isset( $transData[ 'category' ] ) ||
                 ! isset( $transData[ 'text' ] ) ||
                 $transData[ 'category' ] !== $category )
            {
               continue;
            }
            $translations[ $identifier ] = $transData[ 'text' ];
         }
         else
         {
            if ( \is_array( $transData ) && isset( $transData[ 'text' ] ) )
            {
               if ( ( isset( $transData[ 'category' ] ) && $transData[ 'category' ] === '' ) ||
                    ! isset( $transData[ 'category' ] ) )
               {
                  $translations[ $identifier ] = $transData[ 'text' ];
               }
            }
            else if ( \is_string( $transData ) )
            {
               $translations[ $identifier ] = $transData;
            }
         }

      }

      return $translations;

   }
public function getTranslations( $category = null ) : array
   {

      $translations = [];

      // If no category is defined (must be NULL) return all translations without a
      if ( \is_null( $category ) )
      {

         foreach ( $this->_translations as $identifier => $transData )
         {
            if ( is_string( $transData ) )
            {
               $translations[ $identifier ] = $transData;
               continue;
            }
            if ( ! \is_array( $transData ) || ! isset( $transData[ 'text' ] ) )
            {
               continue;
            }
            $translations[ $identifier ] = $transData[ 'text' ];
         }

         return $translations;

      }

      $category     = \trim( $category );
      $withCategory = \strlen( $category ) > 0;

      $this->getCategories();

      if ( ! \in_array( $category, $this->_categories ) && $category !== '' )
      {
         return $translations;
      }

      foreach ( $this->_translations as $identifier => $transData )
      {

         if ( $withCategory )
         {
            if ( ! \is_array( $transData ) ||
                 ! isset( $transData[ 'category' ] ) ||
                 ! isset( $transData[ 'text' ] ) ||
                 $transData[ 'category' ] !== $category )
            {
               continue;
            }
            $translations[ $identifier ] = $transData[ 'text' ];
         }
         else
         {
            if ( \is_array( $transData ) && isset( $transData[ 'text' ] ) )
            {
               if ( ( isset( $transData[ 'category' ] ) && $transData[ 'category' ] === '' ) ||
                    ! isset( $transData[ 'category' ] ) )
               {
                  $translations[ $identifier ] = $transData[ 'text' ];
               }
            }
            else if ( \is_string( $transData ) )
            {
               $translations[ $identifier ] = $transData;
            }
         }

      }

      return $translations;

   }
public function getTranslations ( $ category = null ) : array { $ translations = [ ] ; // If no category is defined (must be NULL) return all translations without a if ( \ is_null ( $ category ) ) { foreach ( $ this -> _translations as $ identifier => $ transData ) { if ( is_string ( $ transData ) ) { $ translations [ $ identifier ] = $ transData ; continue ; } if ( ! \ is_array ( $ transData ) || ! isset ( $ transData [ 'text' ] ) ) { continue ; } $ translations [ $ identifier ] = $ transData [ 'text' ] ; } return $ translations ; } $ category = \ trim ( $ category ) ; $ withCategory = \ strlen ( $ category ) > 0 ; $ this -> getCategories ( ) ; if ( ! \ in_array ( $ category , $ this -> _categories ) && $ category !== '' ) { return $ translations ; } foreach ( $ this -> _translations as $ identifier => $ transData ) { if ( $ withCategory ) { if ( ! \ is_array ( $ transData ) || ! isset ( $ transData [ 'category' ] ) || ! isset ( $ transData [ 'text' ] ) || $ transData [ 'category' ] !== $ category ) { continue ; } $ translations [ $ identifier ] = $ transData [ 'text' ] ; } else { if ( \ is_array ( $ transData ) && isset ( $ transData [ 'text' ] ) ) { if ( ( isset ( $ transData [ 'category' ] ) && $ transData [ 'category' ] === '' ) || ! isset ( $ transData [ 'category' ] ) ) { $ translations [ $ identifier ] = $ transData [ 'text' ] ; } } else if ( \ is_string ( $ transData ) ) { $ translations [ $ identifier ] = $ transData ; } } } return $ translations ; }
Gets all translations of an specific category. If not category is defined all translations of all categories
are returned.

@param string $category
@return array
Gets all translations of an specific category . If not category is defined all translations of all categories are returned .