Skip to content

An idea needed for translate subject when this one was in config message options #22

Description

@olekhy

Currently isn't possible to perform auto translate when used options value. F.e. config

'sxmail' => [
        'configs' => [
            'default' => [
               // ...
                'message' => [
                    'options' => [
                        'subject'  => 'Hey no body is perfect', 
                    ],
                ],
            ],

this 'Hey no body is perfect' needed to be translated for different countries. I have no idea how to done this. Please help me :) thx!

BTW
// TODO: DI never initiate an instance via new operator maybe we need $this->getMessage() and I can use $this->setMessage($message// from factory) to

/**
     * Compose a new message.
     *
     * @param   mixed   $body   Accepts instance of ViewModel, string and null.
     * @param   string  $mimeType
     *
     * @return  \Zend\Mail\Message
     * @throws  \SxMail\Exception\InvalidArgumentException
     */
    public function compose($body = null, $mimeType = null)
    {
        // Supported types are null, ViewModel and string.
        if (null !== $body && !is_string($body) && !($body instanceof ViewModel)) {
            throw new InvalidArgumentException(
                'Invalid value supplied. Expected null, string or instance of Zend\View\Model\ViewModel.'
            );
        }

        $body    = $this->manipulateBody($body, $mimeType);
        $message = new Message; // TODO: (DI fault) never  initiate via new operator maybe $this->getMessage() and I can use $this->setMessage($message// from factory) 

        $message->setBody($body);

        if ($this->config['message']['generate_alternative_body'] && count($body->getParts()) > 1) {
            $message->getHeaders()->get('content-type')->setType('multipart/alternative');
        }

        $this->applyMessageHeaders($message);
        $this->applyMessageOptions($message);

        return $message;
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions