Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Add translation functionality to Add Address pages

Kevin Ottley edited this page Aug 17, 2016 · 1 revision

In version 3.3.4 we added code to a few view files to support the ability to translate the Add Address page. If you have a custom theme that includes any of the following view files and you wish to have this new translation ability, please make the following changes to your code.

/mail/_contactform.php

<tr>
   <td bgcolor="#f8f8f8" style="padding:15px 15px 15px 15px;color:#111111;font-family:'Lucida Grande','Lucida Sans', Verdana, sans-serif;font-size: 12px;line-height:1.5em; border: 1px solid #dddddd;">
-     <b><?= Yii::t('email', 'From:') ?></b><?= ' ' . $model->fromName ?><br/>
-     <b><?=Yii::t('email', 'Email:') ?></b><?= ' ' . $model->fromEmail ?><br/>
-     <b><?=Yii::t('email', 'Subject:') ?></b><?= ' ' . $model->contactSubject ?><br/>
+     <b><?= Yii::t('email', 'From') ?>:</b><?= ' ' . $model->fromName ?><br/>
+     <b><?=Yii::t('email', 'Email') ?>:</b><?= ' ' . $model->fromEmail ?><br/>
+     <b><?=Yii::t('email', 'Subject') ?>:</b><?= ' ' . $model->contactSubject ?><br/>
      <br/>
      <br/>
      <?= $model->contactBody ?>
   </td>
</tr>

###/myaccount/_addressform.php

<ol class="field-containers-small field-container-gap">
   <li class="field-container field-container-split">
      <label class="placeheld" for="recipient-firstname">
	<?= Yii::t('profile', 'First Name'); ?>
      </label>
-     <input type="text" name="first_name" placeholder="First Name" id="recipient-firstname" class="no-right-border" required="" autofocus="">
+     <input type="text" name="first_name" placeholder="<?= Yii::t('profile', 'First Name'); ?>" id="recipient-firstname" class="no-right-border" required="" autofocus="">
   </li>
   <li class="field-container field-container-split field-container-split-latter">
      <label class="placeheld" for="recipient-lastname"><?= Yii::t('profile', 'Last Name'); ?></label>
-     <input placeholder="Last Name" required="required" name="last_name" id="recipient-lastname" type="text">
+     <input placeholder="<?= Yii::t('profile', 'Last Name'); ?>" required="required" name="last_name" id="recipient-lastname" type="text">
   </li>
   <li class="field-container-toggle">
      <a href="#" id="recipient-company-toggle">
         <?= Yii::t('profile', 'Company'); ?>
      </a>
   </li>
   <li class="field-container company-container" style="display: none;">
      <label class="placeheld" for="recipient-company"><?= Yii::t('profile', 'Company'); ?></label>
-	<input type="text" name="company" placeholder="Company" class="no-top-border" id="recipient-company">
+	<input type="text" name="company" placeholder="<?= Yii::t('profile', 'Company'); ?>" class="no-top-border" id="recipient-company">
   </li>
</ol>

<ol class="select-options">
   <li>
      <label class="checkbox" for="recipient-residential">
      <input type="checkbox" name="residential" id="recipient-residential" class="label-toggle">
+        <?= Yii::t('profile', 'This is a residential address'); ?>
-        <?= Yii::t('checkout', 'This is a residential address'); ?>
      </label>
   </li>
</ol>

<ol class="field-containers-small field-container-gap">
   <li class="field-container field-container-nobottomborder">
-     <label class="placeheld" for="recipient-address1"><?= Yii::t('profile', 'Address 1'); ?></label>
-     <input type="text" name="address1" placeholder="Mailing address" id="recipient-address1" class="no-bottom-border" required="">
+     <label class="placeheld" for="recipient-address1"><?= Yii::t('profile', 'Mailing Address'); ?></label>
+     <input type="text" name="address1" placeholder="<?= Yii::t('profile', 'Mailing Address'); ?>" id="recipient-address1" class="no-bottom-border" required="">
   </li> 
   <li class="field-container">
-     <label class="placeheld" for="recipient-address2"><?= Yii::t('profile', 'Address 2'); ?></label>
-     <input type="text" name="address2" placeholder="Suite, Floor, etc." id="recipient-address2">
+     <label class="placeheld" for="recipient-address2"><?= Yii::t('profile', 'Suite, Floor, etc.'); ?></label>
+     <input type="text" name="address2" placeholder="<?= Yii::t('profile', 'Suite, Floor, etc.'); ?>" id="recipient-address2">
   </li>
   <li class="fieldgroup city-fieldgroup">
      <ol>
         <li class="field-container">
            <label class="placeheld" for="recipient-zip"><?= Yii::t('profile', 'Zip'); ?></label>
-           <input type="text" name="postal" size="6" placeholder="Zip" id="recipient-zip" required="">
+           <input type="text" name="postal" size="6" placeholder="<?= Yii::t('profile', 'Zip'); ?>" id="recipient-zip" required="">
         </li>
	 <li class="field-container">
            <label class="placeheld" for="recipient-city"><?= Yii::t('profile', 'City'); ?></label>
-           <input type="text" name="city" size="26" placeholder="City" id="recipient-city" required="">
+           <input type="text" name="city" size="26" placeholder="<?= Yii::t('profile', 'City'); ?>" id="recipient-city" required="">
	 </li>
	 <li class="field-container">
-          <label class="placeheld" for="recipient-state-code"><?= Yii::t('profile', 'State / Province'); ?></label>
-          <input type="text" size="4" placeholder="State" id="recipient-state-code" required="">
+          <label class="placeheld" for="recipient-state-code"><?= Yii::t('profile', 'State'); ?></label>
+          <input type="text" size="4" placeholder="<?= Yii::t('forms', 'State/Province'); ?>" id="recipient-state-code" required="">
           <input id="recipient-state-id" type="hidden" name="state_id">
         </li>
      </ol>

/myaccount/_editprofilemodal.php

<form id="edit-profile-form" class="error">
   <div class="error-holder hide">
      <div class="form-error">
      </div>
   </div>
   <ol>
      <li class="field-container">
-        <label class="placeheld"><?= Yii::t('forms', 'Name'); ?></label>
-        <input type="text" id="edit-first-name" name="first_name" placeholder="<?= Yii::t('forms', 'First name'); ?>" required="" class="split-2-first" autofocus="">
-        <input type="text" id="edit-last-name" name="last_name" placeholder="<?= Yii::t('forms', 'Last name'); ?>" required="" class="split-2">
+        <label class="placeheld"><?= Yii::t('profile', 'Name'); ?></label>
+        <input type="text" id="edit-first-name" name="first_name" placeholder="<?= Yii::t('profile', 'First name'); ?>" required="" class="split-2-first" autofocus="">
+        <input type="text" id="edit-last-name" name="last_name" placeholder="<?= Yii::t('profile', 'Last name'); ?>" required="" class="split-2">
      </li>
      <li class="field-container ">
-        <label class="placeheld"><?= Yii::t('forms', 'Email'); ?></label>
-        <input type="email" id="edit-email" name="email" required="" placeholder="<?= Yii::t('forms', 'Email'); ?>">
+        <label class="placeheld"><?= Yii::t('email', 'Email'); ?></label>
+         <input type="email" id="edit-email" name="email" required="" placeholder="<?= Yii::t('profile', 'Email'); ?>">
      </li>
      <li class="field-container ">
         <label class="placeheld"><?= Yii::t('forms', 'Phone'); ?></label>
         <input type="tel" id="edit-phone" name="mainphone" placeholder="<?= Yii::t('forms', 'Phone'); ?>">
      </li>
      <li>
         <label class="checkbox">
            <input type="checkbox" id="edit-newsletter-subscribe" class="label-toggle" name="newsletter_subscribe">
-           <?= Yii::t('forms', 'Allow us to send you emails about our products'); ?>
+           <?= Yii::t('profile', 'Allow us to send you emails about our products'); ?>
         </label>
      </li>
   </ol>
   <footer class="submit">
-     <input type="submit" id="save-profile" value="Save Changes">
+     <input type="submit" id="save-profile" value="<?= Yii::t('profile', 'Save Changes'); ?>">
   </footer>
</form>
<button class="webstore-modal-close">
-  <?=
-     Yii::t(
-        'forms',
-        'Close'
-     );
-  ?>
+  <?= Yii::t('forms', 'Close'); ?>
</button>
Clone this wiki locally