1

I've an e-commerce site in Magento 1.9 with two version: English and French. I've to change some words in both English version and in the French. For example, in the English version, I've to change word "BAG" shown in the following image: enter image description here

I've to replace "BAG" with "SHOPPING BAG" but, inserting string "BAG", "SHOPPING BAG" (or "bag","shopping bag", or "Bag", "Shopping bag") into translate.csv of the theme (in the English folder) any change is shown in the frontend. Activating path hints for the English version I notice that the phtml file that builds the block that contains this menu is the following:

<meta http-equiv="Content-Type" content="<?php echo $this->getContentType() ?>" />
<title><?php echo $this->getTitle()?></title>
<meta name="description" content="<?php echo htmlspecialchars($this->getDescription()) ?>" />
<meta name="keywords" content="<?php echo htmlspecialchars($this->getKeywords()) ?>" />
<meta name="robots" content="<?php echo htmlspecialchars($this->getRobots()) ?>" />
<link rel="icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getFaviconFile(); ?>" type="image/x-icon" />
<?php
    $currentUrl = Mage::helper('core/url')->getCurrentUrl();
    if (preg_match('/^https/', $currentUrl)) {
        $currentUrl = str_replace('https://', 'http://', $currentUrl);
    }

    $exclusions = array(
        'checkout/',
        'customer/account/'
    );
    $regexUrl = '/^' . str_replace(array('/', '.'), array('\\/', '\\.'), Mage::getBaseUrl() . '(?:(?:' . implode(')|(?:', $exclusions) . '))') . '/';
    if (!preg_match($regexUrl, $currentUrl)) {
        echo '<link rel="canonical" href="' . $currentUrl . '" />';
    }
?>
<!--[if lt IE 7]>
<script type="text/javascript">
//<![CDATA[
    var BLANK_URL = '<?php echo $this->helper('core/js')->getJsUrl('blank.html') ?>';
    var BLANK_IMG = '<?php echo $this->helper('core/js')->getJsUrl('spacer.gif') ?>';
//]]>
</script>
<![endif]-->

<?php echo $this->getCssJsHtml() ?>
<?php echo $this->getChildHtml() ?>
<?php echo $this->getIncludes() ?>

I think that there are some function (may be getHtmlChild()) that overwrites my translation because other words are translated adding new strings into traslate.csv.

Which file or function I've to change to see "shopping bag" in the frontend of my site? Why some words are changed with translate.csv and others not? Can you help me, please? Thank you very much!

1 Answer 1

1

For translate any string you passed should be like :

<?php echo $this->__('Text here'); ?>

Then only it translate from CSV.

8
  • thanks..Have I to add $this->__('Bag'); or have I to find it? Where have I to add or find it?
    – luca
    Nov 9, 2016 at 8:53
  • when you echo your Bag at that place you need to set the string in this formate Nov 9, 2016 at 8:54
  • or you can override and set all menu string in this formate Nov 9, 2016 at 8:55
  • have I to change echo $this->__('bag') with echo $this->__('shopping bag') in the phtml file that builds the block? and then have I to add in traslate.csv of French language (for example) a string like "Shopping bag","Panier"? Is it correct?
    – luca
    Nov 9, 2016 at 11:33
  • yes, correct. after that you can replace Shopping bag with any string from csv. Nov 9, 2016 at 11:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.