cedricfontaine Posted September 16, 2013 Share Posted September 16, 2013 Hello, I try to display a birthday date in text in a module. As it's a parameter, I'm unable to make it translatable in smarty, neither in the module php file. I tried this very complicated syntax at last, but he doesn't work... $months=array('01'=>$this->l('January'),'02'=>$this->l('February'),'03'=>$this->l('March'),'04'=>$this->l('April'),'05'=>$this->l('May'),'06'=>$this->l('June'),'07'=>$this->l('July'),'08'=>$this->l('August'),'09'=>$this->l('September'),'10'=>$this->l('October'),'11'=>$this->l('November'),'12'=>$this->l('December')); $mois=explode('-',$this->context->customer->birthday); $mois=$mois[1]; $mois=$months[$mois]; I keep displaying the month in english, even it appears in the translation of my module in the back office, but it keeps displaying the english version... Link to comment Share on other sites More sharing options...
vekia Posted September 16, 2013 Share Posted September 16, 2013 take a look how it looks in authentication.tpl file, there is a comment with months: {* {l s='January'} {l s='February'} {l s='March'} {l s='April'} {l s='May'} {l s='June'} {l s='July'} {l s='August'} {l s='September'} {l s='October'} {l s='November'} {l s='December'} *} and these translations (!) are used in foreach loop: {foreach from=$months key=k item=month} <option value="{$k}" {if ($sl_month == $k)} selected="selected"{/if}>{l s=$month} </option> {/foreach} Try the same method, paste this in .tpl file Link to comment Share on other sites More sharing options...
cedricfontaine Posted September 19, 2013 Author Share Posted September 19, 2013 Hello, You're right. I add to mix comments with translations and {l s=$month}. Thanks Link to comment Share on other sites More sharing options...
hamletmad Posted November 30, 2014 Share Posted November 30, 2014 Sorry but, could you please post how you finally write the select showing months ? Im having the same error Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now