Problem with email translation in Magento 1.9

I have a translation problem. I don't understand why my content translates well on the website but not in the email. The translation is done in csv files, but when I call the offer as usual Magento got an English translation instead of English.

email / stock.phtml:

    <?php if ($products = $this->getProducts()): ?>
<p><?php echo $this->__('You are receiving this notification because you subscribed to receive alerts when the following products are back in stock:') ?></p>
<table>
<?php foreach ($products as $product): ?>
    <tr>
        <td><a href="<?php echo $product->getProductUrl() ?>" title="<?php echo $this->escapeHtml($product->getName()) ?>"><img src="<?php echo $this->helper('catalog/image')->init($product, 'thumbnail')->resize(75, 75) ?>" border="0" align="left" height="75" width="75" alt="<?php echo $this->escapeHtml($product->getName()) ?>" /></a></td>
        <td>
            <p><a href="<?php echo $product->getProductUrl() ?>"><strong><?php echo $this->escapeHtml($product->getName()) ?></strong></a></p>
            <?php $shortDescription = $this->_getFilteredProductShortDescription($product) ?>
            <?php if ($shortDescription): ?>
                <p><small><?php echo $shortDescription ?></small></p>
            <?php endif; ?>
            <p><?php if ($product->getPrice() != $product->getFinalPrice()): ?>
                <?php echo $this->__('Regular Price:') ?> <strong style="text-decoration:line-through;"><?php echo Mage::helper('core')->currency($product->getPrice()) ?></strong><br />
                <strong><?php echo $this->__('Special price:') ?> <span style="color:#FF0000;"><?php echo Mage::helper('core')->currency($product->getFinalPrice()) ?></span></strong>
            <?php else: ?>
                <strong><?php echo $this->__('Price:') ?></strong> <?php echo Mage::helper('core')->currency($product->getPrice()) ?>
            <?php endif; ?></p>
            <p><small><a href="<?php echo $this->getProductUnsubscribeUrl($product->getId()) ?>"><?php echo $this->__('Click here not to receive alerts for this product') ?></a></small></p>
        </td>
    </tr>
<?php endforeach; ?>
</table>
<p><a href="<?php echo $this->getUnsubscribeUrl() ?>"><?php echo $this->__('Unsubscribe from all stock alerts') ?></a></p>
<?php endif; ?>

      

Do you know how to tell Magento to take the French translation in my email template?

+3


source to share


2 answers


To translate an email, you can copy it from a folder en_US

to the appropriate language folder (for example es_ES

) and then translate it. When you do, you can add or remove other vars from the email as well. Most emails will contain headers that show you what is available to you.

As far as adding the country code to the phone number, you will need to define a new block in the module that will do it for you.



There is also another solution at the link

+1


source


First of the possibilities: https://magento.stackexchange.com/questions/25612/cron-job-template-block-not-being-translated-but-testobserver-is

Second possibility:

The function responsible for sending the product release alert is called send and exists in the file around line 229:

app/code/core/Mage/ProductAlert/Model/Email.php

Function using the code below to get the customer store:

$store = Mage::getModel('core/store')->load($this->_customer->getStoreId());



The getStoreId function on the client gets data from the "Created from - account [created_in]" field

So, if the client was created by an administrator from the backend - the client will always set the default (admin) settings for language, currency, translations, etc.

Check what is returned to the client who is mistaken in translation and / or url by this code:

<?php if(Mage::getSingleton('customer/session')->isLoggedIn()) {
   $customerData = Mage::getSingleton('customer/session')->getCustomer();
   echo $customerData->getStoreId();
} ?>

      

If it is 0, then the case.

+1


source







All Articles