string will not be translated

For programming and general questions on Zend Framework
Post Reply
mich620
Posts: 3
Joined: Wed Jan 20, 2016 4:25 pm
Location: Swizerland

string will not be translated

Post by mich620 » Wed Jan 20, 2016 4:59 pm

Hello
entry in string is not translated
I tried on the Different Types. I do not know what to do.
can anyone see what I have wrong?

This is the text. "setSubject" and "header message" is not a translation.

//////////////////////////////////////////////////
public function noSale()
{
$this->_mail->setFrom($this->_settings['admin_email'], $this->_settings['email_admin_title'])
->setTo($this->_user->getData('email'))
->setSubject('Listings Closed - No Sale');

$this->_view->headerMessage = $this->_('Listings Closed - No Sale');
$this->_view->clearContent()
->process('emails/no-sale.phtml');

return $this;
}

///////////////////////////////////////////////

also in this text it does not want to translate
at this point: $ name = $ translate -> _ ('- Comment:').

/////////////////////////////////////////////////
$messages[] = sprintf($translate->_("The user's balance has been changed to: %s %s"),
$view->amount(abs($params['balance'])), (($params['balance'] > 0) ? 'debit' : 'credit'));

$settings = $this->getSettings();

$amount = $params['balance'] - $this->getData('balance');

$name = sprintf($translate->_('Admin Balance Adjustment - User ID: #%s'), $this->getData('id')). "\n";

if ($params['balance_adjustment_reason']) {
$name .= $translate->_(' - Comment: ') . $params['balance_adjustment_reason'];
}

/////////////////////////////////////////////////////////////////////

where do I do mistakes

mich620
Posts: 3
Joined: Wed Jan 20, 2016 4:25 pm
Location: Swizerland

Re: string will not be translated

Post by mich620 » Thu Jan 21, 2016 11:06 am

Nobody has any idea or can help?

tedtiger
Posts: 244
Joined: Thu Mar 05, 2009 4:59 pm
Location: Germany
Contact:

Re: string will not be translated

Post by tedtiger » Thu Jan 21, 2016 12:51 pm

Maybe it's related to the - in the text. Have you copied this from a Word Document? Maybe he can't find the translations because the - is not really a -.

mich620
Posts: 3
Joined: Wed Jan 20, 2016 4:25 pm
Location: Swizerland

Re: string will not be translated

Post by mich620 » Thu Jan 21, 2016 6:06 pm

No., it is from a PHP file.
is this string di not translate

Code: Select all

public function noSale()
    {
        $this->_mail->setFrom($this->_settings['admin_email'], $this->_settings['email_admin_title'])
            ->setTo($this->_user->getData('email'))
            ->setSubject('Listings Closed - No Sale');

        $this->_view->headerMessage = $this->_('Listings Closed - No Sale');
        $this->_view->clearContent()
            ->process('emails/no-sale.phtml');

        return $this;
    }
this from the same file will be translated

Code: Select all

public function newBid($listingId, UserModel $bidder, $bidAmount)
    {
        $listingsService = new ListingsService();
        $listing = $listingsService->findBy('id', $listingId);
        $seller = $listing->findParentRow('\Ppb\Db\Table\Users');

        $this->setData(array(
            'listing'   => $listing,
            'bidAmount' => $bidAmount,
            'bidder'    => $bidder
        ));

        $translate = $this->_mail->getTranslate();

        $this->_mail->setFrom($this->_settings['admin_email'], $this->_settings['email_admin_title'])
            ->setTo($seller->getData('email'))
            ->setSubject(
                sprintf($translate->_('%s - New Bid Placed'), $listing['name']));

        $this->_view->headerMessage = $this->_('New Bid Notification');
        $this->_view->clearContent()
            ->process('emails/new-bid.phtml');

        return $this;
    }
in the po file it is translated.
and in the po file is also reference to this PHP file

if you want I can post the whole PHP file.

tedtiger
Posts: 244
Joined: Thu Mar 05, 2009 4:59 pm
Location: Germany
Contact:

Re: string will not be translated

Post by tedtiger » Fri Jan 22, 2016 8:03 am

Have you checked for encoding problems. I've had such an error only with special chars and encoding.

Post Reply