I'm using Opencart v2.3.0.2. Need help in how to translate some text strings. I've added some links to my header menu (in /catalog/view/theme/mytheme/template/common/header.tpl) using code :
<ul class="static_links">
<li class="head-links">
<a href="<?php echo $about_products; ?>">
<?php echo $text_products; ?>
</a>
</li>
<li class="head-links">
<a href="<?php echo $contact; ?>">
<?php echo $text_novosti; ?>
</a>
</li>
<li class="head-links">
<a href="<?php echo $contact; ?>">
<?php echo $text_onas; ?>
</a>
</li>
</ul>
Also I've added new strings and translations in footer.php (/catalog/language/ru-ru/common/footer.php):
$_['text_products'] = 'О продуктах'; $_['$text_novosti'] = 'Новости'; $_['$text_onas'] = 'О нас';
Finally I've registered that translations in header.php (/catalog/controller/common/header.php):
//New links in menu
$data['text_products'] = $this->language->get('text_products');
$data['text_novosti'] = $this->language->get('text_novosti');
$data['text_onas'] = $this->language->get('text_onas');
After all when I open page with menu it shows only translation texts for $text_products
. In other places it shows only value text_novosti
and text_onas
. But in should show translations from footer.php instead.
Please help me, how to display translations correctly?
Or maybe there is a way to hardcode texts based on language? Something like:
<?php if ($lang='en') {?> <a href="#">News</a><a href="#">About us</a>
<?php } ?>
НовостиО нас