Jump to content

Cannot translate month names


starbolt
 Share

Recommended Posts

Hello,

 

I'm having some trouble to translate the months names on Prestashop 1.4.8. The following code has the months but when i change them to my language, they are not changed in Prestashop. Im not using any cache so I'm pretty sure that it's not working.

 

Any clues? The following code is taken from identity.tpl in my themes folder. Everything is translated, except the month names in the select.

 

  <p class="select">
<label>{l s='Data de Nascimento'}</label>
<select name="days" id="days">
 <option value="">-</option>
 {foreach from=$days item=v}
  <option value="{$v|escape:'htmlall':'UTF-8'}" {if ($sl_day == $v)}selected="selected"{/if}>{$v|escape:'htmlall':'UTF-8'}  </option>
 {/foreach}
</select>
{*
 {l s='Janeiro'}
 {l s='Fevereiro'}
 {l s='Março'}
 {l s='Abril'}
 {l s='Maio'}
 {l s='Junho'}
 {l s='Julho'}
 {l s='Agosto'}
 {l s='Setembro'}
 {l s='Outubro'}
 {l s='Novembro'}
 {l s='Dezembro'}
*}
<select id="months" name="months">
 <option value="">-</option>
 {foreach from=$months key=k item=v}
  <option value="{$k|escape:'htmlall':'UTF-8'}" {if ($sl_month == $k)}selected="selected"{/if}>{l s="$v"} </option>
 {/foreach}
</select>
<select id="years" name="years">
 <option value="">-</option>
 {foreach from=$years item=v}
  <option value="{$v|escape:'htmlall':'UTF-8'}" {if ($sl_year == $v)}selected="selected"{/if}>{$v|escape:'htmlall':'UTF-8'}  </option>
 {/foreach}
</select>
  </p>

Edited by starbolt (see edit history)

Share this post


Link to post
Share on other sites

that is not a good way to go about it...

it's simple to translate using the back office

  • back office-->tools-->translations
  • select front office translations
  • select the flag of the languge you want to translate
  • expand all fields
  • find the text you want to translate, translate it, scroll to the bottom and click save...

You will be updating authentification

 

suerte

Share this post


Link to post
Share on other sites

  • 1 year later...

Anyone knows how to fix this? I am at presta 1.6 and same problem. I've translated in backoffice the months and they always appear in english no matter what.

 

just found this only happens when edditing an old account, when creating a new one, there's no problem. 

Edited by tiga (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

I had the same problem in PS 1.6, months in english in the create account form and identity sections.

I've fixed it adding the next code before the months foreach in authentication.tpl and identity.tpl:

{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'}

After that load the forms in the website, and it will generate the translation string, you can go to the admin > translations > front-office translations and the new list of months will be available for translation.

  • Like 2

Share this post


Link to post
Share on other sites

  • 2 months later...

DannetStudio solution works.

 

Thanks!

<div class="col-xs-4">
                            <select id="months" name="months" class="form-control">
                                <option value="">-</option>
                                {foreach from=$months key=k item=v}
                                    <option value="{$k}" {if ($sl_month == $k)}selected="selected"{/if}>{l s=$v} </option>
                                    	{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'}
                                {/foreach}
                            </select>
                        </div>

Share this post


Link to post
Share on other sites

  • 3 weeks later...

No soy un experto en esto pero creo que si la página te queda en blanco es porque hay algún código mal abierto o cerrado.

 

Trata de que el primer <div> y el </div> final queden en la misma linea (vertical). Lo mismo con el <select id>.

 

Si no te funciona avisa y lo vemos.

 

Suerte

<div class="col-xs-4">
                            <select id="months" name="months" class="form-control">
                                <option value="">-</option>
                                {foreach from=$months key=k item=v}
                                    <option value="{$k}" {if ($sl_month == $k)}selected="selected"{/if}>{l s=$v} </option>
                                    	{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'}
                                {/foreach}
                            </select>
</div>

Share this post


Link to post
Share on other sites

  • 1 year later...

I had the same problem in PS 1.6, months in english in the create account form and identity sections.

 

I've fixed it adding the next code before the months foreach in authentication.tpl and identity.tpl:

{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'}

After that load the forms in the website, and it will generate the translation string, you can go to the admin > translations > front-office translations and the new list of months will be available for translation.

Thanks a lot !!! After 3 hours searching, it worked for me!!

I already tried to copy the months list in the identity.tpl file but it didn't work. It just needed to be reloaded in the Translation page on the BO and enter again the translation. Thank you soooo much !!! :D

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More