我的翻译问题。我不明白为什么我的内容在网站上翻译得很好,但在电子邮件中却没有。翻译是在csv文件中完成的,但是当我像往常一样调用句子时,Magento得到的是英文翻译而不是法文翻译。
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; ?>
你知道如何对Magento说它必须在我的电子邮件模板中采用法语翻译吗?
答案 0 :(得分:1)
要翻译电子邮件,您可以将其从en_US
文件夹复制到相应的语言文件夹(例如es_ES
),然后执行翻译。执行此操作时,您还可以从电子邮件中添加或删除其他变量。大多数电子邮件都会有标题,告诉您哪些变量可用。
至于将国家/地区代码添加到电话号码中,您需要在模块中定义一个新块,以便为您执行此操作。
还有另一种解决方案答案 1 :(得分:1)
负责发送产品缺货警报的功能称为发送,并存在于第229行附近的文件中:
app/code/core/Mage/ProductAlert/Model/Email.php
该功能使用以下代码获取客户的商店:
$store = Mage::getModel('core/store')->load($this->_customer->getStoreId());
因此,如果客户是由管理员从后端创建的 - 客户将始终获得语言,货币,翻译等的默认商店(管理员)设置。
通过以下代码检查客户返回的错误翻译和/或网址:
<?php if(Mage::getSingleton('customer/session')->isLoggedIn()) {
$customerData = Mage::getSingleton('customer/session')->getCustomer();
echo $customerData->getStoreId();
} ?>
如果是0 - 就是这种情况。