1

I've a great problem with translations management on my magento 1.9 e-commerce site. I've to change some words and phrases in French language. In particular I've to change this translation:

"Submit","Soumettre"

In:

"Submit","S'identifier"

"Soumettre" is a label of a button.

I added new tanslation in file translate.csv of French language folder of the theme. This path file is the following:

app\design\frontend\enterprise\theme\locale\fr_FR\translate.csv

And the added row is:

"Submit","S'identifier"

I expected that this translation overwrite those contained in the folder

app/locale/fr_FR 

but this dosn't happen.

The phtml file that manages the view is the following: frontend/enterprise/theme/template/page/1column.phtml

The button is shown the following image: enter image description here

PHP is the following:

<?php
/**
 * Magento Enterprise Edition
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Magento Enterprise Edition License
 * that is bundled with this package in the file LICENSE_EE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://www.magentocommerce.com/license/enterprise-edition
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    design
 * @package     enterprise_default
 * @copyright   Copyright (c) 2014 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://www.magentocommerce.com/license/enterprise-edition
 */
?>
<?php
/**
 * Template for Mage_Page_Block_Html
 */
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $this->getLang() ?>"
      lang="<?php echo $this->getLang() ?>">
<head>
    <?php echo $this->getChildHtml('head') ?>
    <meta name="viewport" content="<?php
    echo(Mage::helper("balmain/MobileDetect")->isiOS() ? " minimal-ui, " : "");
    ?> width=device-width, height=device-height, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>

    <?php
    $msie = strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), 'msie') ? true : false;
    if ($msie) {
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"http://" . $_SERVER['HTTP_HOST'] . "/skin/frontend/enterprise/balmain/css/balmain_ie.css\" media=\"all\" />";
    }
    $fire = strpos(strtolower($_SERVER["HTTP_USER_AGENT"]), 'fire') ? true : false;
    if ($fire) {
        echo "<link rel=\"stylesheet\" type=\"text/css\" href=\"http://" . $_SERVER['HTTP_HOST'] . "/skin/frontend/enterprise/balmain/css/balmain_fire.css\" media=\"all\" />";
    }
    ?>
    <meta http-equiv="X-UA-Compatible" content="IE=10">


    <script type="application/ld+json">
{
  "@context" : "http://schema.org",
  "@type" : "Organization",
  "name" : "Balmain",
  "url" : "http://www.balmain.com/",
  "sameAs" : [
    "https://www.facebook.com/balmainparis",
    "https://www.twitter.com/Balmain",
    "https://plus.google.com/+BALMAINofficial/",
    "https://www.instagram.com/balmain/",
    "https://www.youtube.com/user/BALMAINofficial"
  ]
}
    </script>


</head>


<body data-locale="<?php echo Mage::app()->getStore()->getCode(); ?>"
    <?php
    echo ' class="body ' . ($this->getBodyClass() ? $this->getBodyClass() : "")
        . (Mage::helper("balmain/MobileDetect")->isiPad() ? " device__ipad" : "")
        . (Mage::helper("balmain/MobileDetect")->isiPhone() ? " device__iphone" : "")
        . '"'
    ?>>
<?php /*
        <!-- Google Tag Manager -->
        <noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-KRQDMC"
                          height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
        <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
                new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
        j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
            '//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
        })(window,document,'script','dataLayer','GTM-KRQDMC');</script>
        <!-- End Google Tag Manager -->

         */ ?>

<?php /*
    <div id="iphoneLandscapeMessage">
        <div class="wrapper_iphoneLandscapeMessage">
            <div class="message_iphone_logo"></div>
            <div class="message_iphone__landscape">

                <?php
                echo $this->__("Please rotate your device into Portrait mode");
                ?>
            </div>
        </div>
    </div>
*/ ?>

<?php echo $this->getChildHtml('global_messages') ?>

<div class="all-wrap-balmain default-skin" id="all-wrap-balmain">
    <div class="main-cookies-warning">
        <div class="add-new-product"></div>
    </div>
    <div class="preventScrollInAllPage"></div>
    <?php echo $this->getChildHtml('after_body_start') ?>
    <div class="wrapper">
        <?php echo $this->getChildHtml('global_notices') ?>
        <div class="page">
            <?php echo $this->getChildHtml('header') ?>

            <?php echo $this->getChildHtml('breadcrumbsContainer') ?>
            <div id="main-right-column" class="main col1-layout">
                <div class="col-main">
                    <?php echo $this->getChildHtml('content') ?>
                </div>
            </div>

            <?php echo $this->getChildHtml('global_cookie_notice') ?>
            <?php echo $this->getChildHtml('before_body_end') ?>
        </div>
        <?php echo $this->getChildHtml('footer_before') ?>
        <?php echo $this->getChildHtml('footer') ?>
    </div>
    <?php echo $this->getAbsoluteFooter() ?>
</div>
</body>
</html>

I cleared the cache but the result is always the same.

Can you help me, please?

10
  • Yeah, where is your local theme created? please give full path from the magento root you are placing this file.
    – camdixon
    Nov 3, 2016 at 14:27
  • @camdixon I edited the message!
    – luca
    Nov 3, 2016 at 14:47
  • Ok now, which page are you trying to pull this on? Go to that .phtml file. Link the specific part of the PHP code that is not pulling. If you dont' have it in your theme, copy from original theme that you inherit from and create the file in your theme.
    – camdixon
    Nov 3, 2016 at 14:48
  • frontend/enterprise/theme/template/page/1column.phtml
    – luca
    Nov 3, 2016 at 14:55
  • Great, post the PHP code in the question of the section that is not translating like you want.
    – camdixon
    Nov 3, 2016 at 14:56

1 Answer 1

0

Quick Answer:

<button type="submit" title="<?php echo $this->__('Submit') ?>" 
class="button btn-checkout" onclick="review.save();">
<span><span><?php echo $this->__('Submit') ?></span></span>
</button>

The function $this->__('Submit') pulls translations from the file you placed for anything specifically matching "Submit" and is case sensitive.

Long Answer:

Here is my frontend/enterprise/theme/template/page/1column.phtml file. By the looks of this I would not edit this particular file. You will need to reference one of the getChildHtml files.

<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magento.com for more information.
 *
 * @category    design
 * @package     rwd_default
 * @copyright   Copyright (c) 2006-2015 X.commerce, Inc. (http://www.magento.com)
 * @license     http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * Template for Mage_Page_Block_Html
 */
?>

<!DOCTYPE html>

<!--[if lt IE 7 ]> <html lang="<?php echo $this->getLang(); ?>" id="top" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html lang="<?php echo $this->getLang(); ?>" id="top" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="<?php echo $this->getLang(); ?>" id="top" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="<?php echo $this->getLang(); ?>" id="top" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="<?php echo $this->getLang(); ?>" id="top" class="no-js"> <!--<![endif]-->

<head>
<?php echo $this->getChildHtml('head') ?>
</head>
<body<?php echo $this->getBodyClass()?' class="'.$this->getBodyClass().'"':'' ?>>
<?php echo $this->getChildHtml('after_body_start') ?>
<div class="wrapper">
    <?php echo $this->getChildHtml('global_notices') ?>
    <?php echo $this->getChildHtml('header') ?>
    <div class="page">
        <div class="main-container col1-layout">
            <div class="main">
                <?php echo $this->getChildHtml('breadcrumbs') ?>
                <div class="col-main">
                    <?php echo $this->getChildHtml('global_messages') ?>
                    <?php echo $this->getChildHtml('content') ?>
                </div>
            </div>
        </div>
    </div>

        <?php echo $this->getChildHtml('footer_before') ?>
        <?php echo $this->getChildHtml('footer') ?>
        <?php echo $this->getChildHtml('global_cookie_notice') ?>
        <?php echo $this->getChildHtml('before_body_end') ?>
</div>
<?php echo $this->getAbsoluteFooter() ?>
</body>
</html>

I did my translations in PT (Portuguese) but the idea is the same. From comments above I see you're placing the translation file in proper area. You need to turn on template hints on your development environement system > configuration > select proper store view in top left > developer > "template hints" = yes. Once you do this the .phtml location should show you the actual file to use.

Now, as an example you're trying to change the label of the submit button. You already have your translation in the file in your enterprise/theme directory. "Submit","S'identifier" I am going to use the "submit" button from the one page checkout area and make the change. Because I know this is in the file app/design/frontend/enterprise/theme/template/checkout/onepage/review/button.phtml Right now I am unsure by your question which .phtml file you need to edit because of details. Turn on template hints to find out.

<button type="submit" title="<?php echo $this->__('Submit') ?>" 
class="button btn-checkout" onclick="review.save();">
<span><span><?php echo $this->__('Submit') ?></span></span>
</button>

The function $this->__('Submit') pulls translations from the file you placed for anything specifically matching "Submit" and is case sensitive.

2
  • Thanks, but I added into translate.csv every possible string: "Submit", "...", "SUBMIT", "...", "submit","..." and the result is always the same.. I thinkthere are some files that overwrites my translations but I don't try to solve this situation..
    – luca
    Nov 7, 2016 at 8:35
  • You will only need to pattern Match exactly what is in the code on that particular page.
    – camdixon
    Nov 7, 2016 at 12:22

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.