The latest
blog, you have known about structure in PrestaShop for using Multilanguage or dynamic
language after that I will explain more information in this structure that how
the structure is. For understanding
before you customize the PrestaShop by yourself
admin.php File from folder translations
$_LANGADM['AdminCartRulesd3b206d196cd6be3a2764c1fb90b200f'] = 'Delete selected';
Explaining the structure
$_LANGADM is a variable called Array
'AdminCartRulesd3b206d196cd6be3a2764c1fb90b200f' is the key of the Array it is a part of module and
md5 string
d3b206d196cd6be3a2764c1fb90b200f is MD5 of
string such as Delete selected = d3b206d196cd6be3a2764c1fb90b200f
‘Delete selected’; is value of the word or
statement from Array
For example;
If you change the word from ‘Delete selected’ to ‘selected
to delete’, the word on the screen display will be changed. Absolutely, if you
want to translate other language you can do this.
For example: changing the language
$_LANGADM['AdminCartRulesd3b206d196cd6be3a2764c1fb90b200f'] = '
Sil
seçili '; // turkish
P.S. It is more important, when you change value of
key of the Array, you must not change md5 key that the key is ‘Delete selected’
encrypted.
On next paragraph, I will explain more detail for
key md5 (read more ***)
a template file from modules, in this case, I
choose blockuserinfo module. when you open folder blockuserinfo on ‘\modules\blockuserinfo’
you will look .tpl file at that folder, surely, filename .tpl is a PHP Smarty
template that is on views folder or outside that folder.
For example: PHP Smarty
Template
<p id="header_user_info">
{l s='Welcome' mod='blockuserinfo'}
{if $logged}
<a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='View my
customer account' mod='blockuserinfo'}" class="account" rel="nofollow"><span>{$cookie->customer_firstname} {$cookie->customer_lastname}</span></a>
<a href="{$link->getPageLink('index', true, NULL, "mylogout")|escape:'html'}" title="{l s='Log me out'
mod='blockuserinfo'}" class="logout" rel="nofollow">{l s='Sign out' mod='blockuserinfo'}</a>
{else}
<a href="{$link->getPageLink('my-account', true)|escape:'html'}" title="{l s='Log in to
your customer account' mod='blockuserinfo'}" class="login" rel="nofollow">{l s='Sign in' mod='blockuserinfo'}</a>
{/if}
</p>
|
In the structure .tpl, the file that contains tag
for display Multilanguage on screen as follows;
{l s='Welcome' mod='blockuserinfo'}
{l s='View my customer account' mod='blockuserinfo'}
{l s='Log me out' mod='blockuserinfo'}
{l s='Log in to your customer
account' mod='blockuserinfo'}
{l s='Sign in' mod='blockuserinfo'}
Describing:
{}
is a tag for display from PHP smarty
l
is a language
s
is a string or sentence
mod
is a module name
Normally,
writing tag in smarty template I will always write in an English for
standardization, so it’s meaning I have never written en.php file. Even though,
some module write tag smarty not standardization I need to write en.php file
too.
Be
careful, writing “ l s=’String key’ from native language you must encrypt md5
from that language.
Next session, I will explain a relation of
translations and module with .tpl and .php
Tags:
Admin, Introduction, Language, Module, Multilanguage, PHP, PrestaShop, Smarty, Translation,
Writer:
WindowsDNA
No comments:
Post a Comment